OLD | NEW |
1 // Copyright (c) 2012 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 | |
29 PluginGlobals::~PluginGlobals() { | 22 PluginGlobals::~PluginGlobals() { |
30 DCHECK(plugin_globals_ == this || !plugin_globals_); | 23 DCHECK(plugin_globals_ == this); |
31 plugin_globals_ = NULL; | 24 plugin_globals_ = NULL; |
32 } | 25 } |
33 | 26 |
34 ResourceTracker* PluginGlobals::GetResourceTracker() { | 27 ResourceTracker* PluginGlobals::GetResourceTracker() { |
35 return &plugin_resource_tracker_; | 28 return &plugin_resource_tracker_; |
36 } | 29 } |
37 | 30 |
38 VarTracker* PluginGlobals::GetVarTracker() { | 31 VarTracker* PluginGlobals::GetVarTracker() { |
39 return &plugin_var_tracker_; | 32 return &plugin_var_tracker_; |
40 } | 33 } |
(...skipping 10 matching lines...) Expand all Loading... |
51 if (dispatcher) | 44 if (dispatcher) |
52 return dispatcher->GetFunctionAPI(id); | 45 return dispatcher->GetFunctionAPI(id); |
53 return NULL; | 46 return NULL; |
54 } | 47 } |
55 | 48 |
56 PP_Module PluginGlobals::GetModuleForInstance(PP_Instance instance) { | 49 PP_Module PluginGlobals::GetModuleForInstance(PP_Instance instance) { |
57 // Currently proxied plugins don't use the PP_Module for anything useful. | 50 // Currently proxied plugins don't use the PP_Module for anything useful. |
58 return 0; | 51 return 0; |
59 } | 52 } |
60 | 53 |
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 | |
73 } // namespace proxy | 54 } // namespace proxy |
74 } // namespace ppapi | 55 } // namespace ppapi |
OLD | NEW |