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

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

Issue 9006055: Move the tracked completion callback code into shared impl. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 8
9 namespace ppapi { 9 namespace ppapi {
10 namespace proxy { 10 namespace proxy {
11 11
12 PluginGlobals* PluginGlobals::plugin_globals_ = NULL; 12 PluginGlobals* PluginGlobals::plugin_globals_ = NULL;
13 13
14 PluginGlobals::PluginGlobals() 14 PluginGlobals::PluginGlobals()
15 : ppapi::PpapiGlobals(), 15 : ppapi::PpapiGlobals(),
16 plugin_proxy_delegate_(NULL) { 16 plugin_proxy_delegate_(NULL) {
17 DCHECK(!plugin_globals_); 17 DCHECK(!plugin_globals_);
18 plugin_globals_ = this; 18 plugin_globals_ = this;
19
20 callback_tracker_ = new CallbackTracker;
viettrungluu 2011/12/29 03:45:27 Why don't you initialize this in the initializer l
19 } 21 }
20 22
21 PluginGlobals::~PluginGlobals() { 23 PluginGlobals::~PluginGlobals() {
22 DCHECK(plugin_globals_ == this); 24 DCHECK(plugin_globals_ == this);
23 plugin_globals_ = NULL; 25 plugin_globals_ = NULL;
24 } 26 }
25 27
26 ResourceTracker* PluginGlobals::GetResourceTracker() { 28 ResourceTracker* PluginGlobals::GetResourceTracker() {
27 return &plugin_resource_tracker_; 29 return &plugin_resource_tracker_;
28 } 30 }
29 31
30 VarTracker* PluginGlobals::GetVarTracker() { 32 VarTracker* PluginGlobals::GetVarTracker() {
31 return &plugin_var_tracker_; 33 return &plugin_var_tracker_;
32 } 34 }
33 35
36 CallbackTracker* PluginGlobals::GetCallbackTrackerForInstance(
37 PP_Instance /* instance */) {
viettrungluu 2011/12/29 03:45:27 I thought we weren't in the habit of commenting ou
38 // In the plugin process, the callback tracker is always the same, regardless
39 // of the instance.
40 return callback_tracker_.get();
41 }
42
34 FunctionGroupBase* PluginGlobals::GetFunctionAPI(PP_Instance inst, ApiID id) { 43 FunctionGroupBase* PluginGlobals::GetFunctionAPI(PP_Instance inst, ApiID id) {
35 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(inst); 44 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(inst);
36 if (dispatcher) 45 if (dispatcher)
37 return dispatcher->GetFunctionAPI(id); 46 return dispatcher->GetFunctionAPI(id);
38 return NULL; 47 return NULL;
39 } 48 }
40 49
41 PP_Module PluginGlobals::GetModuleForInstance(PP_Instance instance) { 50 PP_Module PluginGlobals::GetModuleForInstance(PP_Instance instance) {
42 // Currently proxied plugins don't use the PP_Module for anything useful. 51 // Currently proxied plugins don't use the PP_Module for anything useful.
43 return 0; 52 return 0;
44 } 53 }
45 54
46 } // namespace proxy 55 } // namespace proxy
47 } // namespace ppapi 56 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698