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

Unified Diff: webkit/glue/plugins/pepper_plugin_module.cc

Issue 2148001: Chromium side of supporting property enumeration, memory allocation, querying... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | « webkit/glue/plugins/pepper_plugin_instance.cc ('k') | webkit/glue/plugins/pepper_var.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/pepper_plugin_module.cc
===================================================================
--- webkit/glue/plugins/pepper_plugin_module.cc (revision 48067)
+++ webkit/glue/plugins/pepper_plugin_module.cc (working copy)
@@ -6,8 +6,10 @@
#include <set>
+#include "base/message_loop_proxy.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
+#include "base/time.h"
#include "third_party/ppapi/c/ppb_core.h"
#include "third_party/ppapi/c/ppb_device_context_2d.h"
#include "third_party/ppapi/c/ppb_image_data.h"
@@ -40,6 +42,12 @@
return &live_plugin_libs;
}
+base::MessageLoopProxy* GetMainThreadMessageLoop() {
+ static scoped_refptr<base::MessageLoopProxy> proxy(
+ base::MessageLoopProxy::CreateForCurrentThread());
+ return proxy.get();
+}
+
// PPB_Core --------------------------------------------------------------------
void AddRefResource(PP_Resource resource) {
@@ -60,9 +68,32 @@
res->Release();
}
+void* MemAlloc(size_t num_bytes) {
+ return malloc(num_bytes);
+}
+
+void MemFree(void* ptr) {
+ free(ptr);
+}
+
+double GetTime() {
+ return base::Time::Now().ToDoubleT();
+}
+
+void CallOnMainThread(int delay_in_msec, void (*func)(void*), void* context) {
+ GetMainThreadMessageLoop()->PostDelayedTask(
+ FROM_HERE,
+ NewRunnableFunction(func, context),
+ delay_in_msec);
+}
+
const PPB_Core core_interface = {
&AddRefResource,
&ReleaseResource,
+ &MemAlloc,
+ &MemFree,
+ &GetTime,
+ &CallOnMainThread
};
// GetInterface ----------------------------------------------------------------
@@ -88,6 +119,7 @@
initialized_(false),
library_(0),
ppp_get_interface_(NULL) {
+ GetMainThreadMessageLoop(); // Initialize the main thread message loop.
GetLivePluginSet()->insert(this);
}
« no previous file with comments | « webkit/glue/plugins/pepper_plugin_instance.cc ('k') | webkit/glue/plugins/pepper_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698