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

Side by Side Diff: content/child/websocket_message_filter.h

Issue 2000113002: Delegate WebSocket message handlers to the loading task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment Created 4 years, 7 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 | « content/child/websocket_dispatcher.cc ('k') | content/child/websocket_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
(Empty)
1 // Copyright 2016 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 CONTENT_CHILD_WEBSOCKET_MESSAGE_FILTER_H_
6 #define CONTENT_CHILD_WEBSOCKET_MESSAGE_FILTER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "ipc/message_filter.h"
12
13 namespace base {
14 class SingleThreadTaskRunner;
15 }
16
17 namespace content {
18
19 class WebSocketDispatcher;
20
21 // Delegates IPC messages to a WebSocketDispatcher on the loading task queue
22 // instead of the default task queue.
23 class WebSocketMessageFilter : public IPC::MessageFilter {
24 public:
25 explicit WebSocketMessageFilter(WebSocketDispatcher* websocket_dispatcher);
26
27 // IPC::MessageFilter implementation.
28 bool OnMessageReceived(const IPC::Message& message) override;
29
30 void SetLoadingTaskRunner(
31 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner) {
32 loading_task_runner_ = loading_task_runner;
33 }
34
35 private:
36 ~WebSocketMessageFilter() override;
37 void OnMessageReceivedOnMainThread(const IPC::Message& message);
38
39 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_;
40
41 // This actual object is owned by a ChildThreadImpl and is derefed only on the
42 // main thread.
43 base::WeakPtr<WebSocketDispatcher> websocket_dispatcher_;
44
45 DISALLOW_COPY_AND_ASSIGN(WebSocketMessageFilter);
46 };
47
48 } // namespace content
49
50 #endif // CONTENT_CHILD_WEBSOCKET_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « content/child/websocket_dispatcher.cc ('k') | content/child/websocket_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698