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

Unified Diff: src/trusted/plugin/service_runtime.cc

Issue 7216027: typesafe call-on-main-thread interface. no cast to/from void* required. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/plugin/service_runtime.h ('k') | src/trusted/weak_ref/call_on_main_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/plugin/service_runtime.cc
===================================================================
--- src/trusted/plugin/service_runtime.cc (revision 5730)
+++ src/trusted/plugin/service_runtime.cc (working copy)
@@ -32,6 +32,8 @@
#include "native_client/src/trusted/plugin/srt_socket.h"
#include "native_client/src/trusted/plugin/utility.h"
+#include "native_client/src/trusted/weak_ref/call_on_main_thread.h"
+
#include "native_client/src/trusted/service_runtime/nacl_error_code.h"
#include "native_client/src/trusted/service_runtime/include/sys/nacl_imc_api.h"
@@ -55,26 +57,20 @@
};
// Must be called on the main thread.
-void LogToJavaScriptConsole(nacl::WeakRef<LogToJavaScriptConsoleResource>* wr,
+void LogToJavaScriptConsole(LogToJavaScriptConsoleResource* p,
int32_t err) {
UNREFERENCED_PARAMETER(err);
- nacl::scoped_ptr<LogToJavaScriptConsoleResource> p;
- wr->ReleaseAndUnref(&p);
- if (p == NULL) {
- NaClLog(1, "LogToJavaScriptConsole: Weak ref died\n");
- return;
- }
- NaClLog(1, "LogToJavaScriptConsole: Weak ref okay: %p\n",
- reinterpret_cast<void*>(p.get()));
p->plugin->browser_interface()->AddToConsole(p->plugin->instance_id(),
p->message);
}
void PluginReverseInterface::Log(nacl::string message) {
- (void) WeakRefCompletionCallback(anchor_, 0,
- LogToJavaScriptConsole,
- new LogToJavaScriptConsoleResource(
- message, plugin_));
+ (void) plugin::WeakRefCallOnMainThread(
+ anchor_,
+ 0, /* delay in ms */
+ LogToJavaScriptConsole,
+ new LogToJavaScriptConsoleResource(
+ message, plugin_));
}
ServiceRuntime::ServiceRuntime(Plugin* plugin)
« no previous file with comments | « src/trusted/plugin/service_runtime.h ('k') | src/trusted/weak_ref/call_on_main_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698