Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/service_runtime.cc

Issue 8826005: Chrome-side change to support stdout/err to postmessage debug hookup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved undef of PostMessage out of instance.h Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2011 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 "native_client/src/trusted/plugin/service_runtime.h" 9 #include "native_client/src/trusted/plugin/service_runtime.h"
10 10
(...skipping 16 matching lines...) Expand all
27 #include "native_client/src/shared/platform/nacl_sync.h" 27 #include "native_client/src/shared/platform/nacl_sync.h"
28 #include "native_client/src/shared/platform/nacl_sync_checked.h" 28 #include "native_client/src/shared/platform/nacl_sync_checked.h"
29 #include "native_client/src/shared/platform/nacl_sync_raii.h" 29 #include "native_client/src/shared/platform/nacl_sync_raii.h"
30 #include "native_client/src/shared/platform/scoped_ptr_refcount.h" 30 #include "native_client/src/shared/platform/scoped_ptr_refcount.h"
31 #include "native_client/src/trusted/desc/nacl_desc_imc.h" 31 #include "native_client/src/trusted/desc/nacl_desc_imc.h"
32 #include "native_client/src/trusted/desc/nrd_xfer.h" 32 #include "native_client/src/trusted/desc/nrd_xfer.h"
33 #include "native_client/src/trusted/desc/nrd_xfer_effector.h" 33 #include "native_client/src/trusted/desc/nrd_xfer_effector.h"
34 #include "native_client/src/trusted/handle_pass/browser_handle.h" 34 #include "native_client/src/trusted/handle_pass/browser_handle.h"
35 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" 35 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
36 36
37 // browser_interface includes portability.h for uintptr_t etc, but it
38 // also transitively includes windows.h, where PostMessage gets
39 // defined as a preprocessor symbol
37 #include "native_client/src/trusted/plugin/browser_interface.h" 40 #include "native_client/src/trusted/plugin/browser_interface.h"
41
38 #include "native_client/src/trusted/plugin/manifest.h" 42 #include "native_client/src/trusted/plugin/manifest.h"
43
44 // This is here due to a Windows API collision; plugin.h through
45 // file_downloader.h transitively includes Instance.h which defines a
46 // PostMessage method, so this undef must appear before any of those.
47 #ifdef PostMessage
48 #undef PostMessage
49 #endif
39 #include "native_client/src/trusted/plugin/plugin.h" 50 #include "native_client/src/trusted/plugin/plugin.h"
40 #include "native_client/src/trusted/plugin/plugin_error.h" 51 #include "native_client/src/trusted/plugin/plugin_error.h"
41 #include "native_client/src/trusted/plugin/scriptable_handle.h" 52 #include "native_client/src/trusted/plugin/scriptable_handle.h"
42 #include "native_client/src/trusted/plugin/srpc_client.h" 53 #include "native_client/src/trusted/plugin/srpc_client.h"
43 #include "native_client/src/trusted/plugin/utility.h" 54 #include "native_client/src/trusted/plugin/utility.h"
44 55
45 #include "native_client/src/trusted/weak_ref/call_on_main_thread.h" 56 #include "native_client/src/trusted/weak_ref/call_on_main_thread.h"
46 57
47 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" 58 #include "native_client/src/trusted/service_runtime/nacl_error_code.h"
48 #include "native_client/src/trusted/service_runtime/include/sys/nacl_imc_api.h" 59 #include "native_client/src/trusted/service_runtime/include/sys/nacl_imc_api.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 CHECK(continuation != NULL); 101 CHECK(continuation != NULL);
91 NaClLog(4, "PluginReverseInterface::Log(%s)\n", message.c_str()); 102 NaClLog(4, "PluginReverseInterface::Log(%s)\n", message.c_str());
92 plugin::WeakRefCallOnMainThread( 103 plugin::WeakRefCallOnMainThread(
93 anchor_, 104 anchor_,
94 0, /* delay in ms */ 105 0, /* delay in ms */
95 ALLOW_THIS_IN_INITIALIZER_LIST(this), 106 ALLOW_THIS_IN_INITIALIZER_LIST(this),
96 &plugin::PluginReverseInterface::Log_MainThreadContinuation, 107 &plugin::PluginReverseInterface::Log_MainThreadContinuation,
97 continuation); 108 continuation);
98 } 109 }
99 110
111 void PluginReverseInterface::DoPostMessage(nacl::string message) {
112 PostMessageResource* continuation = new PostMessageResource(message);
113 CHECK(continuation != NULL);
114 NaClLog(4, "PluginReverseInterface::DoPostMessage(%s)\n", message.c_str());
115 plugin::WeakRefCallOnMainThread(
116 anchor_,
117 0, /* delay in ms */
118 ALLOW_THIS_IN_INITIALIZER_LIST(this),
119 &plugin::PluginReverseInterface::PostMessage_MainThreadContinuation,
120 continuation);
121 }
122
100 void PluginReverseInterface::StartupInitializationComplete() { 123 void PluginReverseInterface::StartupInitializationComplete() {
101 NaClLog(0, "PluginReverseInterface::StartupInitializationComplete\n"); 124 NaClLog(0, "PluginReverseInterface::StartupInitializationComplete\n");
102 if (init_done_cb_.pp_completion_callback().func != NULL) { 125 if (init_done_cb_.pp_completion_callback().func != NULL) {
103 NaClLog(0, 126 NaClLog(0,
104 "PluginReverseInterface::StartupInitializationComplete:" 127 "PluginReverseInterface::StartupInitializationComplete:"
105 " invoking CB\n"); 128 " invoking CB\n");
106 pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb_, PP_OK); 129 pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb_, PP_OK);
107 } else { 130 } else {
108 NaClLog(0, 131 NaClLog(0,
109 "PluginReverseInterface::StartupInitializationComplete:" 132 "PluginReverseInterface::StartupInitializationComplete:"
110 " init_done_cb_ not valid, skipping.\n"); 133 " init_done_cb_ not valid, skipping.\n");
111 } 134 }
112 } 135 }
113 136
114 void PluginReverseInterface::Log_MainThreadContinuation( 137 void PluginReverseInterface::Log_MainThreadContinuation(
115 LogToJavaScriptConsoleResource* p, 138 LogToJavaScriptConsoleResource* p,
116 int32_t err) { 139 int32_t err) {
117 UNREFERENCED_PARAMETER(err); 140 UNREFERENCED_PARAMETER(err);
118 NaClLog(4, 141 NaClLog(4,
119 "PluginReverseInterface::Log_MainThreadContinuation(%s)\n", 142 "PluginReverseInterface::Log_MainThreadContinuation(%s)\n",
120 p->message.c_str()); 143 p->message.c_str());
121 plugin_->browser_interface()->AddToConsole(static_cast<Plugin*>(plugin_), 144 plugin_->browser_interface()->AddToConsole(static_cast<Plugin*>(plugin_),
122 p->message); 145 p->message);
123 } 146 }
147 void PluginReverseInterface::PostMessage_MainThreadContinuation(
148 PostMessageResource* p,
149 int32_t err) {
150 UNREFERENCED_PARAMETER(err);
151 NaClLog(4,
152 "PluginReverseInterface::PostMessage_MainThreadContinuation(%s)\n",
153 p->message.c_str());
154 plugin_->PostMessage(std::string("DEBUG_POSTMESSAGE:") + p->message);
155 }
124 156
125 bool PluginReverseInterface::EnumerateManifestKeys( 157 bool PluginReverseInterface::EnumerateManifestKeys(
126 std::set<nacl::string>* out_keys) { 158 std::set<nacl::string>* out_keys) {
127 Manifest const* mp = plugin_->manifest(); 159 Manifest const* mp = plugin_->manifest();
128 160
129 if (!mp->GetFileKeys(out_keys)) { 161 if (!mp->GetFileKeys(out_keys)) {
130 return false; 162 return false;
131 } 163 }
132 164
133 return true; 165 return true;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 nacl::MutexLocker take(&mu_); 612 nacl::MutexLocker take(&mu_);
581 return exit_status_; 613 return exit_status_;
582 } 614 }
583 615
584 void ServiceRuntime::set_exit_status(int exit_status) { 616 void ServiceRuntime::set_exit_status(int exit_status) {
585 nacl::MutexLocker take(&mu_); 617 nacl::MutexLocker take(&mu_);
586 exit_status_ = exit_status & 0xff; 618 exit_status_ = exit_status & 0xff;
587 } 619 }
588 620
589 } // namespace plugin 621 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698