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

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

Issue 869883003: Never lock the Pepper proxy lock on the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: some pre-review cleanup Created 5 years, 9 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
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 <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread_local_storage.h" 13 #include "base/threading/thread_local_storage.h"
13 #include "ppapi/proxy/connection.h" 14 #include "ppapi/proxy/connection.h"
14 #include "ppapi/proxy/plugin_resource_tracker.h" 15 #include "ppapi/proxy/plugin_resource_tracker.h"
15 #include "ppapi/proxy/plugin_var_tracker.h" 16 #include "ppapi/proxy/plugin_var_tracker.h"
16 #include "ppapi/proxy/ppapi_proxy_export.h" 17 #include "ppapi/proxy/ppapi_proxy_export.h"
17 #include "ppapi/shared_impl/callback_tracker.h" 18 #include "ppapi/shared_impl/callback_tracker.h"
18 #include "ppapi/shared_impl/ppapi_globals.h" 19 #include "ppapi/shared_impl/ppapi_globals.h"
19 20
20 namespace base { 21 namespace base {
21 class Thread; 22 class Thread;
22 } 23 }
23 namespace IPC { 24 namespace IPC {
24 class Sender; 25 class Sender;
25 } 26 }
26 27
27 struct PP_BrowserFont_Trusted_Description; 28 struct PP_BrowserFont_Trusted_Description;
28 29
29 namespace ppapi { 30 namespace ppapi {
30 31
31 struct Preferences; 32 struct Preferences;
32 33
33 namespace proxy { 34 namespace proxy {
34 35
35 class MessageLoopResource; 36 class MessageLoopResource;
37 class PluginMessageFilter;
36 class PluginProxyDelegate; 38 class PluginProxyDelegate;
37 class ResourceReplyThreadRegistrar; 39 class ResourceReplyThreadRegistrar;
40 class UDPSocketFilter;
38 41
39 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { 42 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
40 public: 43 public:
41 PluginGlobals(); 44 PluginGlobals();
42 explicit PluginGlobals(PpapiGlobals::PerThreadForTest); 45 explicit PluginGlobals(PpapiGlobals::PerThreadForTest);
43 virtual ~PluginGlobals(); 46 virtual ~PluginGlobals();
44 47
45 // Getter for the global singleton. Generally, you should use 48 // Getter for the global singleton. Generally, you should use
46 // PpapiGlobals::Get() when possible. Use this only when you need some 49 // PpapiGlobals::Get() when possible. Use this only when you need some
47 // plugin-specific functionality. 50 // plugin-specific functionality.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // is known. This will be used for error logging. 132 // is known. This will be used for error logging.
130 void set_plugin_name(const std::string& name) { plugin_name_ = name; } 133 void set_plugin_name(const std::string& name) { plugin_name_ = name; }
131 134
132 // The embedder should call this function when the command line is known. 135 // The embedder should call this function when the command line is known.
133 void set_command_line(const std::string& c) { command_line_ = c; } 136 void set_command_line(const std::string& c) { command_line_ = c; }
134 137
135 ResourceReplyThreadRegistrar* resource_reply_thread_registrar() { 138 ResourceReplyThreadRegistrar* resource_reply_thread_registrar() {
136 return resource_reply_thread_registrar_.get(); 139 return resource_reply_thread_registrar_.get();
137 } 140 }
138 141
142 UDPSocketFilter* udp_socket_filter() const {
143 return udp_socket_filter_.get();
144 }
145 // Add any necessary ResourceMessageFilters to the PluginMessageFilter so
146 // that they can receive and handle appropriate messages on the IO thread.
147 void RegisterResourceMessageFilters(
148 ppapi::proxy::PluginMessageFilter* plugin_filter);
149
139 // Interval to limit how many IPC messages are sent indicating that the plugin 150 // Interval to limit how many IPC messages are sent indicating that the plugin
140 // is active and should be kept alive. The value must be smaller than any 151 // is active and should be kept alive. The value must be smaller than any
141 // threshold used to kill inactive plugins by the embedder host. 152 // threshold used to kill inactive plugins by the embedder host.
142 void set_keepalive_throttle_interval_milliseconds(unsigned i); 153 void set_keepalive_throttle_interval_milliseconds(unsigned i);
143 154
144 private: 155 private:
145 class BrowserSender; 156 class BrowserSender;
146 157
147 // PpapiGlobals overrides. 158 // PpapiGlobals overrides.
148 virtual bool IsPluginGlobals() const override; 159 virtual bool IsPluginGlobals() const override;
(...skipping 22 matching lines...) Expand all
171 std::string command_line_; 182 std::string command_line_;
172 183
173 scoped_ptr<BrowserSender> browser_sender_; 184 scoped_ptr<BrowserSender> browser_sender_;
174 185
175 // Thread for performing potentially blocking file operations. It's created 186 // Thread for performing potentially blocking file operations. It's created
176 // lazily, since it might not be needed. 187 // lazily, since it might not be needed.
177 scoped_ptr<base::Thread> file_thread_; 188 scoped_ptr<base::Thread> file_thread_;
178 189
179 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; 190 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
180 191
192 scoped_refptr<UDPSocketFilter> udp_socket_filter_;
193
181 // Indicates activity by the plugin. Used to monitor when a plugin can be 194 // Indicates activity by the plugin. Used to monitor when a plugin can be
182 // shutdown due to idleness. Current needs do not require differentiating 195 // shutdown due to idleness. Current needs do not require differentiating
183 // between idle state between multiple instances, if any are active they are 196 // between idle state between multiple instances, if any are active they are
184 // all considered active. 197 // all considered active.
185 bool plugin_recently_active_; 198 bool plugin_recently_active_;
186 199
187 unsigned keepalive_throttle_interval_milliseconds_; 200 unsigned keepalive_throttle_interval_milliseconds_;
188 201
189 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. 202 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h.
190 base::WeakPtrFactory<PluginGlobals> weak_factory_; 203 base::WeakPtrFactory<PluginGlobals> weak_factory_;
191 204
192 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); 205 DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
193 }; 206 };
194 207
195 } // namespace proxy 208 } // namespace proxy
196 } // namespace ppapi 209 } // namespace ppapi
197 210
198 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ 211 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698