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

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: 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
(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
10 namespace IPC {
11 class Message;
12 }
13
14 namespace ppapi {
15 namespace proxy {
16 class ResourceMessageReplyParams;
17
18 // A ResourceMessageFilter lives on the IO thread and handles messages for a
19 // particular resource type. This is necessary in some cases where we want to
20 // reduce latency by doing some work on the IO thread rather than having to
21 // PostTask to the main Pepper thread.
22 //
23 // Note: In some cases we can rely on a reply being associated with a
24 // particular TrackedCallback, in which case we can dispatch directly to the
25 // TrackedCallback's thread. See ReplyThreadRegistrar. That should be the first
26 // choice for avoiding an unecessary jump to the main-thread.
27 //
28 // ResourceMessageFilter is for cases where there is not a one-to-one
29 // relationship between a reply message and a TrackedCallback. For example, for
30 // UDP Socket resources, the browser pushes data to the plugin even when the
31 // plugin does not have a pending callback. We can't use the
32 // ReplyThreadRegistrar, because data may arrive when there's not yet a
33 // TrackedCallback to tell us what thread to use. So instead, we define a
34 // UDPSocketFilter which accepts and queues UDP data on the IO thread.
35 class ResourceMessageFilter
36 : public base::RefCountedThreadSafe<ResourceMessageFilter> {
37 public:
38 virtual bool OnResourceReplyReceived(
39 const ResourceMessageReplyParams& reply_params,
40 const IPC::Message& nested_msg) = 0;
41
42 protected:
43 friend class base::RefCountedThreadSafe<ResourceMessageFilter>;
44 virtual ~ResourceMessageFilter() {}
45 };
46
47 } // namespace proxy
48 } // namespace ppapi
49
50 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698