OLD | NEW |
1 /* -*- c++ -*- */ | 1 /* -*- c++ -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 * Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 // A class containing information regarding a socket connection to a | 8 // A class containing information regarding a socket connection to a |
9 // service runtime instance. | 9 // service runtime instance. |
10 | 10 |
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
13 | 13 |
14 #include "native_client/src/include/nacl_macros.h" | 14 #include "native_client/src/include/nacl_macros.h" |
15 #include "native_client/src/include/nacl_scoped_ptr.h" | 15 #include "native_client/src/include/nacl_scoped_ptr.h" |
16 #include "native_client/src/include/nacl_string.h" | 16 #include "native_client/src/include/nacl_string.h" |
17 #include "native_client/src/shared/imc/nacl_imc.h" | 17 #include "native_client/src/shared/imc/nacl_imc.h" |
18 #include "native_client/src/shared/platform/nacl_sync.h" | 18 #include "native_client/src/shared/platform/nacl_sync.h" |
19 #include "native_client/src/shared/srpc/nacl_srpc.h" | 19 #include "native_client/src/shared/srpc/nacl_srpc.h" |
20 #include "native_client/src/trusted/reverse_service/reverse_service.h" | 20 #include "native_client/src/trusted/reverse_service/reverse_service.h" |
21 #include "native_client/src/trusted/plugin/utility.h" | 21 #include "native_client/src/trusted/plugin/utility.h" |
22 #include "native_client/src/trusted/plugin/file_downloader.h" | |
23 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 22 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
24 #include "native_client/src/trusted/weak_ref/weak_ref.h" | 23 #include "native_client/src/trusted/weak_ref/weak_ref.h" |
25 | 24 |
26 #include "ppapi/cpp/completion_callback.h" | 25 #include "ppapi/cpp/completion_callback.h" |
27 | 26 |
28 namespace nacl { | 27 namespace nacl { |
29 class DescWrapper; | 28 class DescWrapper; |
30 struct SelLdrLauncher; | 29 struct SelLdrLauncher; |
31 } // namespace | 30 } // namespace |
32 | 31 |
33 namespace plugin { | 32 namespace plugin { |
34 | 33 |
35 class BrowserInterface; | 34 class BrowserInterface; |
36 class ErrorInfo; | 35 class ErrorInfo; |
37 class Plugin; | 36 class Plugin; |
38 class SrpcClient; | 37 class SrpcClient; |
39 class ServiceRuntime; | 38 class ServiceRuntime; |
40 | 39 |
41 // Callback resources are essentially our continuation state. | 40 // Callback resources are essentially our continuation state. |
42 | 41 |
43 struct LogToJavaScriptConsoleResource { | 42 struct LogToJavaScriptConsoleResource { |
44 public: | 43 public: |
45 explicit LogToJavaScriptConsoleResource(std::string msg) | 44 explicit LogToJavaScriptConsoleResource(std::string msg) |
46 : message(msg) {} | 45 : message(msg) {} |
47 std::string message; | 46 std::string message; |
48 }; | 47 }; |
49 | 48 |
| 49 struct PostMessageResource { |
| 50 public: |
| 51 explicit PostMessageResource(std::string msg) |
| 52 : message(msg) {} |
| 53 std::string message; |
| 54 }; |
| 55 |
50 struct OpenManifestEntryResource { | 56 struct OpenManifestEntryResource { |
51 public: | 57 public: |
52 OpenManifestEntryResource(std::string target_url, | 58 OpenManifestEntryResource(std::string target_url, |
53 int32_t* descp, | 59 int32_t* descp, |
54 ErrorInfo* infop, | 60 ErrorInfo* infop, |
55 bool* portablep, | 61 bool* portablep, |
56 bool* op_complete) | 62 bool* op_complete) |
57 : url(target_url), | 63 : url(target_url), |
58 out_desc(descp), | 64 out_desc(descp), |
59 error_info(infop), | 65 error_info(infop), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 ServiceRuntime* service_runtime, | 99 ServiceRuntime* service_runtime, |
94 pp::CompletionCallback init_done_cb, | 100 pp::CompletionCallback init_done_cb, |
95 pp::CompletionCallback crash_cb); | 101 pp::CompletionCallback crash_cb); |
96 | 102 |
97 virtual ~PluginReverseInterface(); | 103 virtual ~PluginReverseInterface(); |
98 | 104 |
99 void ShutDown(); | 105 void ShutDown(); |
100 | 106 |
101 virtual void Log(nacl::string message); | 107 virtual void Log(nacl::string message); |
102 | 108 |
| 109 virtual void DoPostMessage(nacl::string message); |
| 110 |
103 virtual void StartupInitializationComplete(); | 111 virtual void StartupInitializationComplete(); |
104 | 112 |
105 virtual bool EnumerateManifestKeys(std::set<nacl::string>* out_keys); | 113 virtual bool EnumerateManifestKeys(std::set<nacl::string>* out_keys); |
106 | 114 |
107 virtual bool OpenManifestEntry(nacl::string url_key, int32_t* out_desc); | 115 virtual bool OpenManifestEntry(nacl::string url_key, int32_t* out_desc); |
108 | 116 |
109 virtual bool CloseManifestEntry(int32_t desc); | 117 virtual bool CloseManifestEntry(int32_t desc); |
110 | 118 |
111 virtual void ReportCrash(); | 119 virtual void ReportCrash(); |
112 | 120 |
113 virtual void ReportExitStatus(int exit_status); | 121 virtual void ReportExitStatus(int exit_status); |
114 | 122 |
115 protected: | 123 protected: |
116 virtual void Log_MainThreadContinuation(LogToJavaScriptConsoleResource* p, | 124 virtual void Log_MainThreadContinuation(LogToJavaScriptConsoleResource* p, |
117 int32_t err); | 125 int32_t err); |
118 | 126 |
| 127 virtual void PostMessage_MainThreadContinuation(PostMessageResource* p, |
| 128 int32_t err); |
| 129 |
119 virtual void OpenManifestEntry_MainThreadContinuation( | 130 virtual void OpenManifestEntry_MainThreadContinuation( |
120 OpenManifestEntryResource* p, | 131 OpenManifestEntryResource* p, |
121 int32_t err); | 132 int32_t err); |
122 | 133 |
123 virtual void StreamAsFile_MainThreadContinuation( | 134 virtual void StreamAsFile_MainThreadContinuation( |
124 OpenManifestEntryResource* p, | 135 OpenManifestEntryResource* p, |
125 int32_t result); | 136 int32_t result); |
126 | 137 |
127 virtual void CloseManifestEntry_MainThreadContinuation( | 138 virtual void CloseManifestEntry_MainThreadContinuation( |
128 CloseManifestEntryResource* cls, | 139 CloseManifestEntryResource* cls, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 208 |
198 PluginReverseInterface* rev_interface_; | 209 PluginReverseInterface* rev_interface_; |
199 | 210 |
200 NaClMutex mu_; | 211 NaClMutex mu_; |
201 int exit_status_; | 212 int exit_status_; |
202 }; | 213 }; |
203 | 214 |
204 } // namespace plugin | 215 } // namespace plugin |
205 | 216 |
206 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 217 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |