| OLD | NEW |
| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/task_runner.h" | 11 #include "base/task_runner.h" |
| 12 #include "content/child/child_thread_impl.h" | 12 #include "content/child/child_thread_impl.h" |
| 13 #include "content/child/thread_safe_sender.h" | 13 #include "content/child/thread_safe_sender.h" |
| 14 #include "ipc/message_filter.h" | 14 #include "ipc/message_filter.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 class ChildMessageFilter::Internal : public IPC::MessageFilter { | 18 class ChildMessageFilter::Internal : public IPC::MessageFilter { |
| 19 public: | 19 public: |
| 20 explicit Internal(ChildMessageFilter* filter) : filter_(filter) {} | 20 explicit Internal(ChildMessageFilter* filter) : filter_(filter) {} |
| 21 | 21 |
| 22 bool OnMessageReceived(const IPC::Message& msg) override { | 22 bool OnMessageReceived(const IPC::Message& msg) override { |
| 23 scoped_refptr<base::TaskRunner> runner = | 23 scoped_refptr<base::TaskRunner> runner = |
| 24 filter_->OverrideTaskRunnerForMessage(msg); | 24 filter_->OverrideTaskRunnerForMessage(msg); |
| 25 if (runner.get() && !runner->RunsTasksOnCurrentThread()) { | 25 if (runner.get() && !runner->RunsTasksInCurrentSequence()) { |
| 26 if (!runner->PostTask( | 26 if (!runner->PostTask( |
| 27 FROM_HERE, | 27 FROM_HERE, |
| 28 base::Bind( | 28 base::Bind( |
| 29 base::IgnoreResult(&ChildMessageFilter::OnMessageReceived), | 29 base::IgnoreResult(&ChildMessageFilter::OnMessageReceived), |
| 30 filter_, msg))) | 30 filter_, msg))) |
| 31 filter_->OnStaleMessageReceived(msg); | 31 filter_->OnStaleMessageReceived(msg); |
| 32 return true; | 32 return true; |
| 33 } | 33 } |
| 34 | 34 |
| 35 return filter_->OnMessageReceived(msg); | 35 return filter_->OnMessageReceived(msg); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 | 57 |
| 58 ChildMessageFilter::~ChildMessageFilter() {} | 58 ChildMessageFilter::~ChildMessageFilter() {} |
| 59 | 59 |
| 60 IPC::MessageFilter* ChildMessageFilter::GetFilter() { | 60 IPC::MessageFilter* ChildMessageFilter::GetFilter() { |
| 61 if (!internal_) | 61 if (!internal_) |
| 62 internal_ = new Internal(this); | 62 internal_ = new Internal(this); |
| 63 return internal_; | 63 return internal_; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace content | 66 } // namespace content |
| OLD | NEW |