OLD | NEW |
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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 power_monitor_broadcaster_.Init(); | 641 power_monitor_broadcaster_.Init(); |
642 | 642 |
643 is_initialized_ = true; | 643 is_initialized_ = true; |
644 init_time_ = base::TimeTicks::Now(); | 644 init_time_ = base::TimeTicks::Now(); |
645 return true; | 645 return true; |
646 } | 646 } |
647 | 647 |
648 bool RenderProcessHostImpl::ShouldUseMojoChannel() const { | 648 bool RenderProcessHostImpl::ShouldUseMojoChannel() const { |
649 const base::CommandLine& command_line = | 649 const base::CommandLine& command_line = |
650 *base::CommandLine::ForCurrentProcess(); | 650 *base::CommandLine::ForCurrentProcess(); |
651 return command_line.HasSwitch(switches::kEnableRendererMojoChannel); | 651 return command_line.HasSwitch(switches::kEnableRendererMojoChannel) || |
| 652 IPC::ChannelMojo::ShouldBeUsed(); |
652 } | 653 } |
653 | 654 |
654 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( | 655 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( |
655 const std::string& channel_id) { | 656 const std::string& channel_id) { |
656 scoped_refptr<base::SingleThreadTaskRunner> runner = | 657 scoped_refptr<base::SingleThreadTaskRunner> runner = |
657 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 658 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
658 if (ShouldUseMojoChannel()) { | 659 if (ShouldUseMojoChannel()) { |
659 VLOG(1) << "Mojo Channel is enabled on host"; | 660 VLOG(1) << "Mojo Channel is enabled on host"; |
660 if (!channel_mojo_host_) { | 661 if (!channel_mojo_host_) { |
661 channel_mojo_host_.reset(new IPC::ChannelMojoHost( | 662 channel_mojo_host_.reset(new IPC::ChannelMojoHost( |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 | 2231 |
2231 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2232 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
2232 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2233 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2233 DCHECK_GT(worker_ref_count_, 0); | 2234 DCHECK_GT(worker_ref_count_, 0); |
2234 --worker_ref_count_; | 2235 --worker_ref_count_; |
2235 if (worker_ref_count_ == 0) | 2236 if (worker_ref_count_ == 0) |
2236 Cleanup(); | 2237 Cleanup(); |
2237 } | 2238 } |
2238 | 2239 |
2239 } // namespace content | 2240 } // namespace content |
OLD | NEW |