1*635a8641SAndroid Build Coastguard Worker // Copyright 2016 The Chromium Authors. All rights reserved. 2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file. 4*635a8641SAndroid Build Coastguard Worker 5*635a8641SAndroid Build Coastguard Worker #include "mojo/public/cpp/system/trap.h" 6*635a8641SAndroid Build Coastguard Worker 7*635a8641SAndroid Build Coastguard Worker #include "mojo/public/c/system/functions.h" 8*635a8641SAndroid Build Coastguard Worker 9*635a8641SAndroid Build Coastguard Worker namespace mojo { 10*635a8641SAndroid Build Coastguard Worker CreateTrap(MojoTrapEventHandler handler,ScopedTrapHandle * trap_handle)11*635a8641SAndroid Build Coastguard WorkerMojoResult CreateTrap(MojoTrapEventHandler handler, 12*635a8641SAndroid Build Coastguard Worker ScopedTrapHandle* trap_handle) { 13*635a8641SAndroid Build Coastguard Worker MojoHandle handle; 14*635a8641SAndroid Build Coastguard Worker MojoResult rv = MojoCreateTrap(handler, nullptr, &handle); 15*635a8641SAndroid Build Coastguard Worker if (rv == MOJO_RESULT_OK) 16*635a8641SAndroid Build Coastguard Worker trap_handle->reset(TrapHandle(handle)); 17*635a8641SAndroid Build Coastguard Worker return rv; 18*635a8641SAndroid Build Coastguard Worker } 19*635a8641SAndroid Build Coastguard Worker 20*635a8641SAndroid Build Coastguard Worker } // namespace mojo 21