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

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

Issue 9187055: Reland 9034035: Make it possible to have 1 PpapiGlobals per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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
« no previous file with comments | « ppapi/proxy/plugin_globals.h ('k') | ppapi/proxy/plugin_resource_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 callback_tracker_(new CallbackTracker) { 17 callback_tracker_(new CallbackTracker) {
18 DCHECK(!plugin_globals_); 18 DCHECK(!plugin_globals_);
19 plugin_globals_ = this; 19 plugin_globals_ = this;
20 } 20 }
21 21
22 PluginGlobals::PluginGlobals(ForTest for_test)
23 : ppapi::PpapiGlobals(for_test),
24 plugin_proxy_delegate_(NULL),
25 callback_tracker_(new CallbackTracker) {
26 DCHECK(!plugin_globals_);
27 }
28
22 PluginGlobals::~PluginGlobals() { 29 PluginGlobals::~PluginGlobals() {
23 DCHECK(plugin_globals_ == this); 30 DCHECK(plugin_globals_ == this || !plugin_globals_);
24 plugin_globals_ = NULL; 31 plugin_globals_ = NULL;
25 } 32 }
26 33
27 ResourceTracker* PluginGlobals::GetResourceTracker() { 34 ResourceTracker* PluginGlobals::GetResourceTracker() {
28 return &plugin_resource_tracker_; 35 return &plugin_resource_tracker_;
29 } 36 }
30 37
31 VarTracker* PluginGlobals::GetVarTracker() { 38 VarTracker* PluginGlobals::GetVarTracker() {
32 return &plugin_var_tracker_; 39 return &plugin_var_tracker_;
33 } 40 }
(...skipping 10 matching lines...) Expand all
44 if (dispatcher) 51 if (dispatcher)
45 return dispatcher->GetFunctionAPI(id); 52 return dispatcher->GetFunctionAPI(id);
46 return NULL; 53 return NULL;
47 } 54 }
48 55
49 PP_Module PluginGlobals::GetModuleForInstance(PP_Instance instance) { 56 PP_Module PluginGlobals::GetModuleForInstance(PP_Instance instance) {
50 // Currently proxied plugins don't use the PP_Module for anything useful. 57 // Currently proxied plugins don't use the PP_Module for anything useful.
51 return 0; 58 return 0;
52 } 59 }
53 60
61 base::Lock* PluginGlobals::GetProxyLock() {
62 #ifdef ENABLE_PEPPER_THREADING
63 return &proxy_lock_;
64 #else
65 return NULL;
66 #endif
67 }
68
69 bool PluginGlobals::IsPluginGlobals() const {
70 return true;
71 }
72
54 } // namespace proxy 73 } // namespace proxy
55 } // namespace ppapi 74 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_globals.h ('k') | ppapi/proxy/plugin_resource_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698