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

Side by Side Diff: ppapi/proxy/plugin_message_filter.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: fix size_t vs int32_t Created 5 years, 8 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
« no previous file with comments | « ppapi/proxy/plugin_globals.cc ('k') | ppapi/proxy/plugin_message_filter.cc » ('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 #ifndef PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_ 5 #ifndef PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
6 #define PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_ 6 #define PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector>
9 10
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "ipc/ipc_sender.h" 13 #include "ipc/ipc_sender.h"
13 #include "ipc/message_filter.h" 14 #include "ipc/message_filter.h"
14 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/proxy/ppapi_proxy_export.h" 16 #include "ppapi/proxy/ppapi_proxy_export.h"
17 #include "ppapi/proxy/resource_message_filter.h"
16 18
17 namespace ppapi { 19 namespace ppapi {
18 namespace proxy { 20 namespace proxy {
19 21
20 class ResourceMessageReplyParams; 22 class ResourceMessageReplyParams;
21 class ResourceReplyThreadRegistrar; 23 class ResourceReplyThreadRegistrar;
22 24
23 // Listens for messages on the I/O thread of the plugin and handles some of 25 // Listens for messages on the I/O thread of the plugin and handles some of
24 // them to avoid needing to block on the plugin. 26 // them to avoid needing to block on the plugin.
25 // 27 //
(...skipping 15 matching lines...) Expand all
41 virtual ~PluginMessageFilter(); 43 virtual ~PluginMessageFilter();
42 44
43 // MessageFilter implementation. 45 // MessageFilter implementation.
44 virtual void OnFilterAdded(IPC::Sender* sender) override; 46 virtual void OnFilterAdded(IPC::Sender* sender) override;
45 virtual void OnFilterRemoved() override; 47 virtual void OnFilterRemoved() override;
46 virtual bool OnMessageReceived(const IPC::Message& message) override; 48 virtual bool OnMessageReceived(const IPC::Message& message) override;
47 49
48 // IPC::Sender implementation. 50 // IPC::Sender implementation.
49 virtual bool Send(IPC::Message* msg) override; 51 virtual bool Send(IPC::Message* msg) override;
50 52
53 void AddResourceMessageFilter(
54 const scoped_refptr<ResourceMessageFilter>& filter);
55
51 // Simulates an incoming resource reply that is handled on the calling thread. 56 // Simulates an incoming resource reply that is handled on the calling thread.
52 // For testing only. 57 // For testing only.
53 static void DispatchResourceReplyForTest( 58 static void DispatchResourceReplyForTest(
54 const ResourceMessageReplyParams& reply_params, 59 const ResourceMessageReplyParams& reply_params,
55 const IPC::Message& nested_msg); 60 const IPC::Message& nested_msg);
56 61
57 private: 62 private:
58 void OnMsgReserveInstanceId(PP_Instance instance, bool* usable); 63 void OnMsgReserveInstanceId(PP_Instance instance, bool* usable);
59 void OnMsgResourceReply(const ResourceMessageReplyParams& reply_params, 64 void OnMsgResourceReply(const ResourceMessageReplyParams& reply_params,
60 const IPC::Message& nested_msg); 65 const IPC::Message& nested_msg);
61 66
62 // Dispatches the given resource reply to the appropriate resource in the 67 // Dispatches the given resource reply to the appropriate resource in the
63 // plugin process. 68 // plugin process.
64 static void DispatchResourceReply( 69 static void DispatchResourceReply(
65 const ResourceMessageReplyParams& reply_params, 70 const ResourceMessageReplyParams& reply_params,
66 const IPC::Message& nested_msg); 71 const IPC::Message& nested_msg);
67 72
68 // All instance IDs ever queried by any renderer on this plugin. This is used 73 // All instance IDs ever queried by any renderer on this plugin. This is used
69 // to make sure that new instance IDs are unique. This is a non-owning 74 // to make sure that new instance IDs are unique. This is a non-owning
70 // pointer. It is managed by PluginDispatcher::PluginDelegate. 75 // pointer. It is managed by PluginDispatcher::PluginDelegate.
71 std::set<PP_Instance>* seen_instance_ids_; 76 std::set<PP_Instance>* seen_instance_ids_;
72 77
73 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; 78 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
74 79
80 std::vector<scoped_refptr<ResourceMessageFilter>> resource_filters_;
81
75 // The IPC sender to the renderer. May be NULL if we're not currently 82 // The IPC sender to the renderer. May be NULL if we're not currently
76 // attached as a filter. 83 // attached as a filter.
77 IPC::Sender* sender_; 84 IPC::Sender* sender_;
78 }; 85 };
79 86
80 } // namespace proxy 87 } // namespace proxy
81 } // namespace ppapi 88 } // namespace ppapi
82 89
83 #endif // PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_ 90 #endif // PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_globals.cc ('k') | ppapi/proxy/plugin_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698