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

Unified Diff: ppapi/shared_impl/ppapi_globals.h

Issue 10910099: PPAPI: Make CompletionCallbacks work right on background threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ppb_message_loop_shared.cc/.h Created 8 years, 1 month 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
Index: ppapi/shared_impl/ppapi_globals.h
diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h
index e95cf48b2392def80cbf9ab4b59b130b54ebe9df..d4112a1ef2c70169e0bad22b244464905d94b756 100644
--- a/ppapi/shared_impl/ppapi_globals.h
+++ b/ppapi/shared_impl/ppapi_globals.h
@@ -24,6 +24,7 @@ class MessageLoopProxy;
namespace ppapi {
class CallbackTracker;
+class MessageLoopShared;
class ResourceTracker;
class VarTracker;
@@ -35,6 +36,7 @@ class ResourceCreationAPI;
// Abstract base class
class PPAPI_SHARED_EXPORT PpapiGlobals {
public:
+ // Must be created on the main thread.
PpapiGlobals();
// This constructor is to be used only for making a PpapiGlobal for testing
@@ -42,7 +44,7 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
// tests that use this feature, the "test" PpapiGlobals should be constructed
// using this method. See SetPpapiGlobalsOnThreadForTest for more information.
struct ForTest {};
- PpapiGlobals(ForTest);
+ explicit PpapiGlobals(ForTest);
virtual ~PpapiGlobals();
@@ -71,6 +73,7 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
virtual VarTracker* GetVarTracker() = 0;
virtual CallbackTracker* GetCallbackTrackerForInstance(
PP_Instance instance) = 0;
+
virtual base::Lock* GetProxyLock() = 0;
// Logs the given string to the JS console. If "source" is empty, the name of
@@ -103,11 +106,14 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
// failure.
virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0;
- // Returns the base::MessageLoopProxy for the main thread. Note that this must
- // be called on the main thread the first time so that it can initialize
- // its static data.
+ // Returns the base::MessageLoopProxy for the main thread. This is set in the
+ // constructor, so PpapiGlobals must be created on the main thread.
base::MessageLoopProxy* GetMainThreadMessageLoop();
+ // Return the MessageLoopShared of the current thread, if any. This will
+ // alwas return NULL on the host side, where PPB_MessageLoop is not supported.
brettw 2012/11/06 23:16:28 "alwas" spelling
dmichael (off chromium) 2012/11/06 23:39:26 Darn, that put me over 80 chars ;-)
+ virtual MessageLoopShared* GetCurrentMessageLoop() = 0;
+
// Returns the command line for the process.
virtual std::string GetCmdLine() = 0;
@@ -127,7 +133,7 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
static PpapiGlobals* ppapi_globals_;
- scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ scoped_refptr<base::MessageLoopProxy> main_loop_proxy_;
DISALLOW_COPY_AND_ASSIGN(PpapiGlobals);
};

Powered by Google App Engine
This is Rietveld 408576698