• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_TRAP_H_
6 #define MOJO_PUBLIC_CPP_SYSTEM_TRAP_H_
7 
8 #include "mojo/public/c/system/trap.h"
9 #include "mojo/public/c/system/types.h"
10 #include "mojo/public/cpp/system/handle.h"
11 #include "mojo/public/cpp/system/system_export.h"
12 
13 namespace mojo {
14 
15 // A strongly-typed representation of a |MojoHandle| for a trap.
16 class TrapHandle : public Handle {
17  public:
18   TrapHandle() = default;
TrapHandle(MojoHandle value)19   explicit TrapHandle(MojoHandle value) : Handle(value) {}
20 
21   // Copying and assignment allowed.
22 };
23 
24 static_assert(sizeof(TrapHandle) == sizeof(Handle),
25               "Bad size for C++ TrapHandle");
26 
27 typedef ScopedHandleBase<TrapHandle> ScopedTrapHandle;
28 static_assert(sizeof(ScopedTrapHandle) == sizeof(TrapHandle),
29               "Bad size for C++ ScopedTrapHandle");
30 
31 MOJO_CPP_SYSTEM_EXPORT MojoResult CreateTrap(MojoTrapEventHandler handler,
32                                              ScopedTrapHandle* trap_handle);
33 
34 }  // namespace mojo
35 
36 #endif  // MOJO_PUBLIC_CPP_SYSTEM_TRAP_H_
37