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

Side by Side Diff: ppapi/proxy/resource_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/ppapi_proxy_test.cc ('k') | ppapi/proxy/resource_reply_thread_registrar.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
6 #define PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/proxy/ppapi_proxy_export.h"
10
11 namespace IPC {
12 class Message;
13 }
14
15 namespace ppapi {
16 namespace proxy {
17 class ResourceMessageReplyParams;
18
19 // A ResourceMessageFilter lives on the IO thread and handles messages for a
20 // particular resource type. This is necessary in some cases where we want to
21 // reduce latency by doing some work on the IO thread rather than having to
22 // PostTask to the main Pepper thread.
23 //
24 // Note: In some cases we can rely on a reply being associated with a
25 // particular TrackedCallback, in which case we can dispatch directly to the
26 // TrackedCallback's thread. See ReplyThreadRegistrar. That should be the first
27 // choice for avoiding an unecessary jump to the main-thread.
28 //
29 // ResourceMessageFilter is for cases where there is not a one-to-one
30 // relationship between a reply message and a TrackedCallback. For example, for
31 // UDP Socket resources, the browser pushes data to the plugin even when the
32 // plugin does not have a pending callback. We can't use the
33 // ReplyThreadRegistrar, because data may arrive when there's not yet a
34 // TrackedCallback to tell us what thread to use. So instead, we define a
35 // UDPSocketFilter which accepts and queues UDP data on the IO thread.
36 class PPAPI_PROXY_EXPORT ResourceMessageFilter
37 : public base::RefCountedThreadSafe<ResourceMessageFilter> {
38 public:
39 virtual bool OnResourceReplyReceived(
40 const ResourceMessageReplyParams& reply_params,
41 const IPC::Message& nested_msg) = 0;
42
43 protected:
44 friend class base::RefCountedThreadSafe<ResourceMessageFilter>;
45 virtual ~ResourceMessageFilter() {}
46 };
47
48 } // namespace proxy
49 } // namespace ppapi
50
51 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.cc ('k') | ppapi/proxy/resource_reply_thread_registrar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698