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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 1262253004: Let IPC::SyncMessageFilter take advantage of thread-safe Send. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minus some code Created 5 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/gpu/client/gpu_channel_host.h" 5 #include "content/common/gpu/client/gpu_channel_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 base::WaitableEvent* shutdown_event) { 71 base::WaitableEvent* shutdown_event) {
72 DCHECK(factory_->IsMainThread()); 72 DCHECK(factory_->IsMainThread());
73 // Open a channel to the GPU process. We pass NULL as the main listener here 73 // Open a channel to the GPU process. We pass NULL as the main listener here
74 // since we need to filter everything to route it to the right thread. 74 // since we need to filter everything to route it to the right thread.
75 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = 75 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
76 factory_->GetIOThreadTaskRunner(); 76 factory_->GetIOThreadTaskRunner();
77 channel_ = IPC::SyncChannel::Create( 77 channel_ = IPC::SyncChannel::Create(
78 channel_handle, IPC::Channel::MODE_CLIENT, NULL, io_task_runner.get(), 78 channel_handle, IPC::Channel::MODE_CLIENT, NULL, io_task_runner.get(),
79 true, shutdown_event, factory_->GetAttachmentBroker()); 79 true, shutdown_event, factory_->GetAttachmentBroker());
80 80
81 sync_filter_ = new IPC::SyncMessageFilter(shutdown_event); 81 sync_filter_ = channel_->CreateSyncMessageFilter();
82
83 channel_->AddFilter(sync_filter_.get());
84 82
85 channel_filter_ = new MessageFilter(); 83 channel_filter_ = new MessageFilter();
86 84
87 // Install the filter last, because we intercept all leftover 85 // Install the filter last, because we intercept all leftover
88 // messages. 86 // messages.
89 channel_->AddFilter(channel_filter_.get()); 87 channel_->AddFilter(channel_filter_.get());
90 } 88 }
91 89
92 bool GpuChannelHost::Send(IPC::Message* msg) { 90 bool GpuChannelHost::Send(IPC::Message* msg) {
93 // Callee takes ownership of message, regardless of whether Send is 91 // Callee takes ownership of message, regardless of whether Send is
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 431
434 listeners_.clear(); 432 listeners_.clear();
435 } 433 }
436 434
437 bool GpuChannelHost::MessageFilter::IsLost() const { 435 bool GpuChannelHost::MessageFilter::IsLost() const {
438 AutoLock lock(lock_); 436 AutoLock lock(lock_);
439 return lost_; 437 return lost_;
440 } 438 }
441 439
442 } // namespace content 440 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/webidbcursor_impl_unittest.cc ('k') | content/renderer/gpu/queue_message_swap_promise_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698