OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_EDK_JS_HANDLE_H_ | 5 #ifndef MOJO_EDK_JS_HANDLE_H_ |
6 #define MOJO_EDK_JS_HANDLE_H_ | 6 #define MOJO_EDK_JS_HANDLE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
9 #include "gin/converter.h" | 11 #include "gin/converter.h" |
10 #include "gin/handle.h" | 12 #include "gin/handle.h" |
11 #include "gin/wrappable.h" | 13 #include "gin/wrappable.h" |
12 #include "mojo/public/cpp/system/core.h" | 14 #include "mojo/public/cpp/system/core.h" |
13 | 15 |
14 namespace mojo { | 16 namespace mojo { |
15 namespace edk { | 17 namespace edk { |
16 class HandleCloseObserver; | 18 class HandleCloseObserver; |
17 | 19 |
(...skipping 23 matching lines...) Expand all Loading... |
41 mojo::ScopedHandle handle_; | 43 mojo::ScopedHandle handle_; |
42 base::ObserverList<HandleCloseObserver> close_observers_; | 44 base::ObserverList<HandleCloseObserver> close_observers_; |
43 }; | 45 }; |
44 | 46 |
45 } // namespace edk | 47 } // namespace edk |
46 } // namespace mojo | 48 } // namespace mojo |
47 | 49 |
48 namespace gin { | 50 namespace gin { |
49 | 51 |
50 // Note: It's important to use this converter rather than the one for | 52 // Note: It's important to use this converter rather than the one for |
51 // MojoHandle, since that will do a simple int32 conversion. It's unfortunate | 53 // MojoHandle, since that will do a simple int32_t conversion. It's unfortunate |
52 // there's no way to prevent against accidental use. | 54 // there's no way to prevent against accidental use. |
53 // TODO(mpcomplete): define converters for all Handle subtypes. | 55 // TODO(mpcomplete): define converters for all Handle subtypes. |
54 template<> | 56 template<> |
55 struct Converter<mojo::Handle> { | 57 struct Converter<mojo::Handle> { |
56 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, | 58 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
57 const mojo::Handle& val); | 59 const mojo::Handle& val); |
58 static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val, | 60 static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val, |
59 mojo::Handle* out); | 61 mojo::Handle* out); |
60 }; | 62 }; |
61 | 63 |
(...skipping 28 matching lines...) Expand all Loading... |
90 return false; | 92 return false; |
91 } | 93 } |
92 *out = gin::Handle<mojo::edk::HandleWrapper>(val, object); | 94 *out = gin::Handle<mojo::edk::HandleWrapper>(val, object); |
93 return true; | 95 return true; |
94 } | 96 } |
95 }; | 97 }; |
96 | 98 |
97 } // namespace gin | 99 } // namespace gin |
98 | 100 |
99 #endif // MOJO_EDK_JS_HANDLE_H_ | 101 #endif // MOJO_EDK_JS_HANDLE_H_ |
OLD | NEW |