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

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

Issue 9296017: Remove static initializer for TLS object. This moves the TLS to the (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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) 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 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_ 5 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_
6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_local_storage.h"
10 #include "ppapi/proxy/plugin_resource_tracker.h" 12 #include "ppapi/proxy/plugin_resource_tracker.h"
11 #include "ppapi/proxy/plugin_var_tracker.h" 13 #include "ppapi/proxy/plugin_var_tracker.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h" 14 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/shared_impl/callback_tracker.h" 15 #include "ppapi/shared_impl/callback_tracker.h"
14 #include "ppapi/shared_impl/ppapi_globals.h" 16 #include "ppapi/shared_impl/ppapi_globals.h"
15 17
16 namespace ppapi { 18 namespace ppapi {
17 namespace proxy { 19 namespace proxy {
18 20
19 class PluginProxyDelegate; 21 class PluginProxyDelegate;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 61 }
60 62
61 // The embedder should call set_proxy_delegate during startup. 63 // The embedder should call set_proxy_delegate during startup.
62 PluginProxyDelegate* plugin_proxy_delegate() { 64 PluginProxyDelegate* plugin_proxy_delegate() {
63 return plugin_proxy_delegate_; 65 return plugin_proxy_delegate_;
64 } 66 }
65 void set_plugin_proxy_delegate(PluginProxyDelegate* d) { 67 void set_plugin_proxy_delegate(PluginProxyDelegate* d) {
66 plugin_proxy_delegate_ = d; 68 plugin_proxy_delegate_ = d;
67 } 69 }
68 70
71 // Returns the TLS slot that holds the message loop TLS.
72 //
73 // If we end up needing more TLS storage for more stuff, we should probably
74 // have a struct in here for the different items.
75 base::ThreadLocalStorage::Slot* msg_loop_slot() {
76 return msg_loop_slot_.get();
77 }
78
79 // Sets the message loop slot, takes ownership of the given heap-alloated
80 // pointer.
81 void set_msg_loop_slot(base::ThreadLocalStorage::Slot* slot) {
82 msg_loop_slot_.reset(slot);
83 }
84
69 // The embedder should call this function when the name of the plugin module 85 // The embedder should call this function when the name of the plugin module
70 // is known. This will be used for error logging. 86 // is known. This will be used for error logging.
71 void set_plugin_name(const std::string& name) { plugin_name_ = name; } 87 void set_plugin_name(const std::string& name) { plugin_name_ = name; }
72 88
73 private: 89 private:
74 // PpapiGlobals overrides. 90 // PpapiGlobals overrides.
75 virtual bool IsPluginGlobals() const OVERRIDE; 91 virtual bool IsPluginGlobals() const OVERRIDE;
76 92
77 static PluginGlobals* plugin_globals_; 93 static PluginGlobals* plugin_globals_;
78 94
79 PluginProxyDelegate* plugin_proxy_delegate_; 95 PluginProxyDelegate* plugin_proxy_delegate_;
80 PluginResourceTracker plugin_resource_tracker_; 96 PluginResourceTracker plugin_resource_tracker_;
81 PluginVarTracker plugin_var_tracker_; 97 PluginVarTracker plugin_var_tracker_;
82 scoped_refptr<CallbackTracker> callback_tracker_; 98 scoped_refptr<CallbackTracker> callback_tracker_;
83 base::Lock proxy_lock_; 99 base::Lock proxy_lock_;
84 100
101 scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_;
102
85 // Name of the plugin used for error logging. This will be empty until 103 // Name of the plugin used for error logging. This will be empty until
86 // SetPluginName is called. 104 // SetPluginName is called.
87 std::string plugin_name_; 105 std::string plugin_name_;
88 106
89 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); 107 DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
90 }; 108 };
91 109
92 } // namespace proxy 110 } // namespace proxy
93 } // namespace ppapi 111 } // namespace ppapi
94 112
95 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ 113 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/ppb_message_loop_proxy.cc » ('j') | ppapi/proxy/ppb_message_loop_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698