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

Side by Side Diff: content/child/child_message_filter.cc

Issue 245443005: Move IPC::MessageFilter and router to a separate file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gn build Created 6 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 | Annotate | Revision Log
« no previous file with comments | « content/child/child_message_filter.h ('k') | content/child/child_resource_message_filter.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/child/child_message_filter.h" 5 #include "content/child/child_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
11 #include "content/child/child_thread.h" 11 #include "content/child/child_thread.h"
12 #include "content/child/thread_safe_sender.h" 12 #include "content/child/thread_safe_sender.h"
13 #include "ipc/message_filter.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class ChildMessageFilter::Internal : public IPC::ChannelProxy::MessageFilter { 17 class ChildMessageFilter::Internal : public IPC::MessageFilter {
17 public: 18 public:
18 explicit Internal(ChildMessageFilter* filter) : filter_(filter) {} 19 explicit Internal(ChildMessageFilter* filter) : filter_(filter) {}
19 20
20 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE { 21 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE {
21 scoped_refptr<base::TaskRunner> runner = 22 scoped_refptr<base::TaskRunner> runner =
22 filter_->OverrideTaskRunnerForMessage(msg); 23 filter_->OverrideTaskRunnerForMessage(msg);
23 if (runner && !runner->RunsTasksOnCurrentThread()) { 24 if (runner && !runner->RunsTasksOnCurrentThread()) {
24 if (!runner->PostTask( 25 if (!runner->PostTask(
25 FROM_HERE, 26 FROM_HERE,
26 base::Bind( 27 base::Bind(
(...skipping 21 matching lines...) Expand all
48 const IPC::Message& msg) { 49 const IPC::Message& msg) {
49 return NULL; 50 return NULL;
50 } 51 }
51 52
52 ChildMessageFilter::ChildMessageFilter() 53 ChildMessageFilter::ChildMessageFilter()
53 : internal_(NULL), 54 : internal_(NULL),
54 thread_safe_sender_(ChildThread::current()->thread_safe_sender()) {} 55 thread_safe_sender_(ChildThread::current()->thread_safe_sender()) {}
55 56
56 ChildMessageFilter::~ChildMessageFilter() {} 57 ChildMessageFilter::~ChildMessageFilter() {}
57 58
58 IPC::ChannelProxy::MessageFilter* ChildMessageFilter::GetFilter() { 59 IPC::MessageFilter* ChildMessageFilter::GetFilter() {
59 if (!internal_) 60 if (!internal_)
60 internal_ = new Internal(this); 61 internal_ = new Internal(this);
61 return internal_; 62 return internal_;
62 } 63 }
63 64
64 } // namespace content 65 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_message_filter.h ('k') | content/child/child_resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698