OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium 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 #define NACL_LOG_MODULE_NAME "Plugin::ServiceRuntime" | 7 #define NACL_LOG_MODULE_NAME "Plugin::ServiceRuntime" |
8 | 8 |
9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" | 9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 void PluginReverseInterface::ShutDown() { | 94 void PluginReverseInterface::ShutDown() { |
95 NaClLog(4, "PluginReverseInterface::Shutdown: entered\n"); | 95 NaClLog(4, "PluginReverseInterface::Shutdown: entered\n"); |
96 nacl::MutexLocker take(&mu_); | 96 nacl::MutexLocker take(&mu_); |
97 shutting_down_ = true; | 97 shutting_down_ = true; |
98 NaClXCondVarBroadcast(&cv_); | 98 NaClXCondVarBroadcast(&cv_); |
99 NaClLog(4, "PluginReverseInterface::Shutdown: broadcasted, exiting\n"); | 99 NaClLog(4, "PluginReverseInterface::Shutdown: broadcasted, exiting\n"); |
100 } | 100 } |
101 | 101 |
102 void PluginReverseInterface::Log(nacl::string message) { | |
103 LogToJavaScriptConsoleResource* continuation = | |
104 new LogToJavaScriptConsoleResource(message); | |
105 CHECK(continuation != NULL); | |
106 NaClLog(4, "PluginReverseInterface::Log(%s)\n", message.c_str()); | |
107 plugin::WeakRefCallOnMainThread( | |
108 anchor_, | |
109 0, /* delay in ms */ | |
110 this, | |
111 &plugin::PluginReverseInterface::Log_MainThreadContinuation, | |
112 continuation); | |
113 } | |
114 | |
115 void PluginReverseInterface::DoPostMessage(nacl::string message) { | 102 void PluginReverseInterface::DoPostMessage(nacl::string message) { |
116 PostMessageResource* continuation = new PostMessageResource(message); | 103 PostMessageResource* continuation = new PostMessageResource(message); |
117 CHECK(continuation != NULL); | 104 CHECK(continuation != NULL); |
118 NaClLog(4, "PluginReverseInterface::DoPostMessage(%s)\n", message.c_str()); | 105 NaClLog(4, "PluginReverseInterface::DoPostMessage(%s)\n", message.c_str()); |
119 plugin::WeakRefCallOnMainThread( | 106 plugin::WeakRefCallOnMainThread( |
120 anchor_, | 107 anchor_, |
121 0, /* delay in ms */ | 108 0, /* delay in ms */ |
122 this, | 109 this, |
123 &plugin::PluginReverseInterface::PostMessage_MainThreadContinuation, | 110 &plugin::PluginReverseInterface::PostMessage_MainThreadContinuation, |
124 continuation); | 111 continuation); |
125 } | 112 } |
126 | 113 |
127 void PluginReverseInterface::StartupInitializationComplete() { | 114 void PluginReverseInterface::StartupInitializationComplete() { |
128 NaClLog(4, "PluginReverseInterface::StartupInitializationComplete\n"); | 115 NaClLog(4, "PluginReverseInterface::StartupInitializationComplete\n"); |
129 if (init_done_cb_.pp_completion_callback().func != NULL) { | 116 if (init_done_cb_.pp_completion_callback().func != NULL) { |
130 NaClLog(4, | 117 NaClLog(4, |
131 "PluginReverseInterface::StartupInitializationComplete:" | 118 "PluginReverseInterface::StartupInitializationComplete:" |
132 " invoking CB\n"); | 119 " invoking CB\n"); |
133 pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb_, PP_OK); | 120 pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb_, PP_OK); |
134 } else { | 121 } else { |
135 NaClLog(1, | 122 NaClLog(1, |
136 "PluginReverseInterface::StartupInitializationComplete:" | 123 "PluginReverseInterface::StartupInitializationComplete:" |
137 " init_done_cb_ not valid, skipping.\n"); | 124 " init_done_cb_ not valid, skipping.\n"); |
138 } | 125 } |
139 } | 126 } |
140 | 127 |
141 void PluginReverseInterface::Log_MainThreadContinuation( | |
142 LogToJavaScriptConsoleResource* p, | |
143 int32_t err) { | |
144 UNREFERENCED_PARAMETER(err); | |
145 NaClLog(4, | |
146 "PluginReverseInterface::Log_MainThreadContinuation(%s)\n", | |
147 p->message.c_str()); | |
148 plugin_->AddToConsole(p->message); | |
149 } | |
150 void PluginReverseInterface::PostMessage_MainThreadContinuation( | 128 void PluginReverseInterface::PostMessage_MainThreadContinuation( |
151 PostMessageResource* p, | 129 PostMessageResource* p, |
152 int32_t err) { | 130 int32_t err) { |
153 UNREFERENCED_PARAMETER(err); | 131 UNREFERENCED_PARAMETER(err); |
154 NaClLog(4, | 132 NaClLog(4, |
155 "PluginReverseInterface::PostMessage_MainThreadContinuation(%s)\n", | 133 "PluginReverseInterface::PostMessage_MainThreadContinuation(%s)\n", |
156 p->message.c_str()); | 134 p->message.c_str()); |
157 plugin_->PostMessage(std::string("DEBUG_POSTMESSAGE:") + p->message); | 135 plugin_->PostMessage(std::string("DEBUG_POSTMESSAGE:") + p->message); |
158 } | 136 } |
159 | 137 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 | 739 |
762 nacl::string ServiceRuntime::GetCrashLogOutput() { | 740 nacl::string ServiceRuntime::GetCrashLogOutput() { |
763 if (NULL != subprocess_.get()) { | 741 if (NULL != subprocess_.get()) { |
764 return subprocess_->GetCrashLogOutput(); | 742 return subprocess_->GetCrashLogOutput(); |
765 } else { | 743 } else { |
766 return std::string(); | 744 return std::string(); |
767 } | 745 } |
768 } | 746 } |
769 | 747 |
770 } // namespace plugin | 748 } // namespace plugin |
OLD | NEW |