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

Side by Side Diff: ppapi/proxy/plugin_globals.cc

Issue 10790078: PPAPI: Make PPB_MessageLoop_Dev::GetForMainThread work (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add a real test Created 8 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/plugin_globals.h" 5 #include "ppapi/proxy/plugin_globals.h"
6 6
7 #include "ppapi/proxy/plugin_dispatcher.h" 7 #include "ppapi/proxy/plugin_dispatcher.h"
8 #include "ppapi/proxy/plugin_proxy_delegate.h" 8 #include "ppapi/proxy/plugin_proxy_delegate.h"
9 #include "ppapi/proxy/ppb_message_loop_proxy.h"
9 #include "ppapi/thunk/enter.h" 10 #include "ppapi/thunk/enter.h"
10 11
11 namespace ppapi { 12 namespace ppapi {
12 namespace proxy { 13 namespace proxy {
13 14
14 PluginGlobals* PluginGlobals::plugin_globals_ = NULL; 15 PluginGlobals* PluginGlobals::plugin_globals_ = NULL;
15 16
16 PluginGlobals::PluginGlobals() 17 PluginGlobals::PluginGlobals()
17 : ppapi::PpapiGlobals(), 18 : ppapi::PpapiGlobals(),
18 plugin_proxy_delegate_(NULL), 19 plugin_proxy_delegate_(NULL),
19 callback_tracker_(new CallbackTracker) { 20 callback_tracker_(new CallbackTracker),
21 loop_for_main_thread_(
22 new MessageLoopResource(MessageLoopResource::ForMainThread())) {
20 DCHECK(!plugin_globals_); 23 DCHECK(!plugin_globals_);
21 plugin_globals_ = this; 24 plugin_globals_ = this;
22 } 25 }
23 26
24 PluginGlobals::PluginGlobals(ForTest for_test) 27 PluginGlobals::PluginGlobals(ForTest for_test)
25 : ppapi::PpapiGlobals(for_test), 28 : ppapi::PpapiGlobals(for_test),
26 plugin_proxy_delegate_(NULL), 29 plugin_proxy_delegate_(NULL),
27 callback_tracker_(new CallbackTracker) { 30 callback_tracker_(new CallbackTracker) {
28 DCHECK(!plugin_globals_); 31 DCHECK(!plugin_globals_);
29 } 32 }
(...skipping 11 matching lines...) Expand all
41 return &plugin_var_tracker_; 44 return &plugin_var_tracker_;
42 } 45 }
43 46
44 CallbackTracker* PluginGlobals::GetCallbackTrackerForInstance( 47 CallbackTracker* PluginGlobals::GetCallbackTrackerForInstance(
45 PP_Instance instance) { 48 PP_Instance instance) {
46 // In the plugin process, the callback tracker is always the same, regardless 49 // In the plugin process, the callback tracker is always the same, regardless
47 // of the instance. 50 // of the instance.
48 return callback_tracker_.get(); 51 return callback_tracker_.get();
49 } 52 }
50 53
54 MessageLoopResource* PluginGlobals::loop_for_main_thread() {
55 return loop_for_main_thread_.get();
56 }
57
51 thunk::PPB_Instance_API* PluginGlobals::GetInstanceAPI(PP_Instance instance) { 58 thunk::PPB_Instance_API* PluginGlobals::GetInstanceAPI(PP_Instance instance) {
52 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 59 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
53 if (dispatcher) 60 if (dispatcher)
54 return dispatcher->GetInstanceAPI(); 61 return dispatcher->GetInstanceAPI();
55 return NULL; 62 return NULL;
56 } 63 }
57 64
58 thunk::ResourceCreationAPI* PluginGlobals::GetResourceCreationAPI( 65 thunk::ResourceCreationAPI* PluginGlobals::GetResourceCreationAPI(
59 PP_Instance instance) { 66 PP_Instance instance) {
60 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 67 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // for the "instance = 0" case. 108 // for the "instance = 0" case.
102 LogWithSource(0, level, source, value); 109 LogWithSource(0, level, source, value);
103 } 110 }
104 111
105 bool PluginGlobals::IsPluginGlobals() const { 112 bool PluginGlobals::IsPluginGlobals() const {
106 return true; 113 return true;
107 } 114 }
108 115
109 } // namespace proxy 116 } // namespace proxy
110 } // namespace ppapi 117 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698