OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 // A class containing information regarding a socket connection to a | 7 // A class containing information regarding a socket connection to a |
8 // service runtime instance. | 8 // service runtime instance. |
9 | 9 |
10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 pp::CompletionCallback cc(reinterpret_cast<void (*)(void*, int32_t)>( | 52 pp::CompletionCallback cc(reinterpret_cast<void (*)(void*, int32_t)>( |
53 callback_fn), | 53 callback_fn), |
54 reinterpret_cast<void*>(wp)); | 54 reinterpret_cast<void*>(wp)); |
55 pp::Module::Get()->core()->CallOnMainThread( | 55 pp::Module::Get()->core()->CallOnMainThread( |
56 delay_in_milliseconds, | 56 delay_in_milliseconds, |
57 cc, | 57 cc, |
58 PP_OK); | 58 PP_OK); |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
62 class LogToJavaScriptConsoleInterface: public nacl::ReverseInterface { | 62 class PluginReverseInterface: public nacl::ReverseInterface { |
63 public: | 63 public: |
64 explicit LogToJavaScriptConsoleInterface( | 64 PluginReverseInterface(nacl::WeakRefAnchor* anchor, |
65 nacl::WeakRefAnchor* anchor, | 65 Plugin* plugin) |
66 Plugin* plugin) | |
67 : anchor_(anchor), | 66 : anchor_(anchor), |
68 plugin_(plugin) { | 67 plugin_(plugin) { |
69 } | 68 } |
70 | 69 |
71 virtual ~LogToJavaScriptConsoleInterface() {} | 70 virtual ~PluginReverseInterface() {} |
72 | 71 |
73 virtual void Log(nacl::string message); | 72 virtual void Log(nacl::string message); |
74 | 73 |
75 private: | 74 private: |
76 nacl::WeakRefAnchor* anchor_; // holds a ref | 75 nacl::WeakRefAnchor* anchor_; // holds a ref |
77 Plugin* plugin_; // value may be copied, but should be used only in | 76 Plugin* plugin_; // value may be copied, but should be used only in |
78 // main thread in WeakRef-protected callbacks. | 77 // main thread in WeakRef-protected callbacks. |
79 }; | 78 }; |
80 | 79 |
81 // ServiceRuntime abstracts a NativeClient sel_ldr instance. | 80 // ServiceRuntime abstracts a NativeClient sel_ldr instance. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 117 |
119 // We need two IMC sockets rather than one because IMC sockets are | 118 // We need two IMC sockets rather than one because IMC sockets are |
120 // not full-duplex on Windows. | 119 // not full-duplex on Windows. |
121 // See http://code.google.com/p/nativeclient/issues/detail?id=690. | 120 // See http://code.google.com/p/nativeclient/issues/detail?id=690. |
122 // TODO(mseaborn): We should not have to work around this. | 121 // TODO(mseaborn): We should not have to work around this. |
123 nacl::DescWrapper* async_receive_desc_; | 122 nacl::DescWrapper* async_receive_desc_; |
124 nacl::DescWrapper* async_send_desc_; | 123 nacl::DescWrapper* async_send_desc_; |
125 | 124 |
126 nacl::WeakRefAnchor *anchor_; | 125 nacl::WeakRefAnchor *anchor_; |
127 | 126 |
128 LogToJavaScriptConsoleInterface* log_interface_; | 127 PluginReverseInterface* rev_interface_; |
129 }; | 128 }; |
130 | 129 |
131 } // namespace plugin | 130 } // namespace plugin |
132 | 131 |
133 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 132 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |