OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // long as the plugin. | 107 // long as the plugin. |
108 MessageLoopResource* loop_for_main_thread(); | 108 MessageLoopResource* loop_for_main_thread(); |
109 | 109 |
110 // The embedder should call this function when the name of the plugin module | 110 // The embedder should call this function when the name of the plugin module |
111 // is known. This will be used for error logging. | 111 // is known. This will be used for error logging. |
112 void set_plugin_name(const std::string& name) { plugin_name_ = name; } | 112 void set_plugin_name(const std::string& name) { plugin_name_ = name; } |
113 | 113 |
114 // The embedder should call this function when the command line is known. | 114 // The embedder should call this function when the command line is known. |
115 void set_command_line(const std::string& c) { command_line_ = c; } | 115 void set_command_line(const std::string& c) { command_line_ = c; } |
116 | 116 |
| 117 // Sets whether threadsafety is supported. Defaults to whether the |
| 118 // ENABLE_PEPPER_THREADING build flag is set. |
| 119 void set_enable_threading(bool enable) { enable_threading_ = enable; } |
| 120 |
117 private: | 121 private: |
118 class BrowserSender; | 122 class BrowserSender; |
119 | 123 |
120 // PpapiGlobals overrides. | 124 // PpapiGlobals overrides. |
121 virtual bool IsPluginGlobals() const OVERRIDE; | 125 virtual bool IsPluginGlobals() const OVERRIDE; |
122 | 126 |
123 static PluginGlobals* plugin_globals_; | 127 static PluginGlobals* plugin_globals_; |
124 | 128 |
125 PluginProxyDelegate* plugin_proxy_delegate_; | 129 PluginProxyDelegate* plugin_proxy_delegate_; |
126 PluginResourceTracker plugin_resource_tracker_; | 130 PluginResourceTracker plugin_resource_tracker_; |
127 PluginVarTracker plugin_var_tracker_; | 131 PluginVarTracker plugin_var_tracker_; |
128 scoped_refptr<CallbackTracker> callback_tracker_; | 132 scoped_refptr<CallbackTracker> callback_tracker_; |
129 | 133 |
| 134 bool enable_threading_; // Indicates whether we'll use the lock. |
130 base::Lock proxy_lock_; | 135 base::Lock proxy_lock_; |
131 | 136 |
132 scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_; | 137 scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_; |
133 // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it | 138 // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it |
134 // must be initialized after msg_loop_slot_ (hence the order here). | 139 // must be initialized after msg_loop_slot_ (hence the order here). |
135 scoped_refptr<MessageLoopResource> loop_for_main_thread_; | 140 scoped_refptr<MessageLoopResource> loop_for_main_thread_; |
136 | 141 |
137 // Name of the plugin used for error logging. This will be empty until | 142 // Name of the plugin used for error logging. This will be empty until |
138 // set_plugin_name is called. | 143 // set_plugin_name is called. |
139 std::string plugin_name_; | 144 std::string plugin_name_; |
140 | 145 |
141 // Command line for the plugin. This will be empty until set_command_line is | 146 // Command line for the plugin. This will be empty until set_command_line is |
142 // called. | 147 // called. |
143 std::string command_line_; | 148 std::string command_line_; |
144 | 149 |
145 scoped_ptr<BrowserSender> browser_sender_; | 150 scoped_ptr<BrowserSender> browser_sender_; |
146 | 151 |
147 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 152 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
148 }; | 153 }; |
149 | 154 |
150 } // namespace proxy | 155 } // namespace proxy |
151 } // namespace ppapi | 156 } // namespace ppapi |
152 | 157 |
153 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 158 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
OLD | NEW |