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

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

Issue 46433002: Support using TrackedCallbacks as hints to determine the handling thread of resource reply messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years 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) 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 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
12 #include "ipc/ipc_sender.h" 12 #include "ipc/ipc_sender.h"
13 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/proxy/ppapi_proxy_export.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 namespace proxy { 17 namespace proxy {
17 18
19 class ResourceMessageReplyParams;
20 class ResourceReplyThreadRegistrar;
21
18 // Listens for messages on the I/O thread of the plugin and handles some of 22 // Listens for messages on the I/O thread of the plugin and handles some of
19 // them to avoid needing to block on the plugin. 23 // them to avoid needing to block on the plugin.
20 // 24 //
21 // There is one instance of this class for each renderer channel (same as for 25 // There is one instance of this class for each renderer channel (same as for
22 // the PluginDispatchers). 26 // the PluginDispatchers).
23 class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter, 27 class PPAPI_PROXY_EXPORT PluginMessageFilter
24 public IPC::Sender { 28 : public IPC::ChannelProxy::MessageFilter,
29 public IPC::Sender {
25 public: 30 public:
26 // The input is a pointer to a set that will be used to uniquify PP_Instances 31 // The input is a pointer to a set that will be used to uniquify PP_Instances
dmichael (off chromium) 2013/12/11 21:30:36 nit: this documentation is a little out of date, w
yzshen1 2013/12/11 22:22:07 I think you might be reading an old patchset. Plea
27 // across all renderer channels. The same pointer should be passed to each 32 // across all renderer channels. The same pointer should be passed to each
28 // MessageFilter to ensure uniqueness, and the value should outlive this 33 // MessageFilter to ensure uniqueness, and the value should outlive this
29 // class. 34 // class.
30 PluginMessageFilter(std::set<PP_Instance>* seen_instance_ids); 35 PluginMessageFilter(
36 std::set<PP_Instance>* seen_instance_ids,
37 scoped_refptr<ResourceReplyThreadRegistrar> thread_registrar);
31 virtual ~PluginMessageFilter(); 38 virtual ~PluginMessageFilter();
32 39
33 // MessageFilter implementation. 40 // MessageFilter implementation.
34 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; 41 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
35 virtual void OnFilterRemoved() OVERRIDE; 42 virtual void OnFilterRemoved() OVERRIDE;
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
37 44
38 // IPC::Sender implementation. 45 // IPC::Sender implementation.
39 virtual bool Send(IPC::Message* msg) OVERRIDE; 46 virtual bool Send(IPC::Message* msg) OVERRIDE;
40 47
48 static void DispatchResourceReplyForTest(
49 const ResourceMessageReplyParams& reply_params,
50 const IPC::Message& nested_msg);
51
41 private: 52 private:
42 void OnMsgReserveInstanceId(PP_Instance instance, bool* usable); 53 void OnMsgReserveInstanceId(PP_Instance instance, bool* usable);
54 void OnMsgResourceReply(const ResourceMessageReplyParams& reply_params,
55 const IPC::Message& nested_msg);
56
57 static void DispatchResourceReply(
58 const ResourceMessageReplyParams& reply_params,
59 const IPC::Message& nested_msg);
43 60
44 // All instance IDs every queried by any renderer on this plugin. This is 61 // All instance IDs every queried by any renderer on this plugin. This is
45 // used to make sure that new instance IDs are unique. This is a non-owning 62 // used to make sure that new instance IDs are unique. This is a non-owning
46 // pointer, it will be managed by the later that creates this class. 63 // pointer, it will be managed by the later that creates this class.
dmichael (off chromium) 2013/12/11 21:30:36 Not part of your CL, but... "later"->"delegate"?
yzshen1 2013/12/11 22:22:07 Done. I changed to: "It is managed by PluginDispa
47 std::set<PP_Instance>* seen_instance_ids_; 64 std::set<PP_Instance>* seen_instance_ids_;
48 65
66 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
67
49 // The IPC channel to the renderer. May be NULL if we're not currently 68 // The IPC channel to the renderer. May be NULL if we're not currently
50 // attached as a filter. 69 // attached as a filter.
51 IPC::Channel* channel_; 70 IPC::Channel* channel_;
52 }; 71 };
53 72
54 } // namespace proxy 73 } // namespace proxy
55 } // namespace ppapi 74 } // namespace ppapi
56 75
57 #endif // PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_ 76 #endif // PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698