| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 | 988 |
| 989 if (!gpu_observer_registered_) { | 989 if (!gpu_observer_registered_) { |
| 990 gpu_observer_registered_ = true; | 990 gpu_observer_registered_ = true; |
| 991 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 991 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
| 992 } | 992 } |
| 993 | 993 |
| 994 power_monitor_broadcaster_.Init(); | 994 power_monitor_broadcaster_.Init(); |
| 995 | 995 |
| 996 is_initialized_ = true; | 996 is_initialized_ = true; |
| 997 init_time_ = base::TimeTicks::Now(); | 997 init_time_ = base::TimeTicks::Now(); |
| 998 last_purge_and_suspend_time_ = base::TimeTicks::TimeTicks(); |
| 998 return true; | 999 return true; |
| 999 } | 1000 } |
| 1000 | 1001 |
| 1001 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( | 1002 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( |
| 1002 const std::string& channel_id) { | 1003 const std::string& channel_id) { |
| 1003 scoped_refptr<base::SingleThreadTaskRunner> runner = | 1004 scoped_refptr<base::SingleThreadTaskRunner> runner = |
| 1004 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 1005 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
| 1005 IPC::mojom::ChannelBootstrapPtr bootstrap; | 1006 IPC::mojom::ChannelBootstrapPtr bootstrap; |
| 1006 GetRemoteInterfaces()->GetInterface(&bootstrap); | 1007 GetRemoteInterfaces()->GetInterface(&bootstrap); |
| 1007 std::unique_ptr<IPC::ChannelFactory> channel_factory = | 1008 std::unique_ptr<IPC::ChannelFactory> channel_factory = |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 Cleanup(); | 1433 Cleanup(); |
| 1433 } | 1434 } |
| 1434 | 1435 |
| 1435 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { | 1436 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { |
| 1436 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1437 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1437 return is_worker_ref_count_disabled_; | 1438 return is_worker_ref_count_disabled_; |
| 1438 } | 1439 } |
| 1439 | 1440 |
| 1440 void RenderProcessHostImpl::PurgeAndSuspend() { | 1441 void RenderProcessHostImpl::PurgeAndSuspend() { |
| 1441 Send(new ChildProcessMsg_PurgeAndSuspend()); | 1442 Send(new ChildProcessMsg_PurgeAndSuspend()); |
| 1443 last_purge_and_suspend_time_ = base::TimeTicks::Now(); |
| 1444 } |
| 1445 |
| 1446 const base::TimeTicks& RenderProcessHostImpl::GetLastPurgeAndSuspendTime() |
| 1447 const { |
| 1448 return last_purge_and_suspend_time_; |
| 1442 } | 1449 } |
| 1443 | 1450 |
| 1444 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { | 1451 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { |
| 1445 if (!remote_route_provider_) { | 1452 if (!remote_route_provider_) { |
| 1446 DCHECK(channel_); | 1453 DCHECK(channel_); |
| 1447 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); | 1454 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); |
| 1448 } | 1455 } |
| 1449 return remote_route_provider_.get(); | 1456 return remote_route_provider_.get(); |
| 1450 } | 1457 } |
| 1451 | 1458 |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3045 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3052 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3046 | 3053 |
| 3047 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3054 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 3048 // enough information here so that we can determine what the bad message was. | 3055 // enough information here so that we can determine what the bad message was. |
| 3049 base::debug::Alias(&error); | 3056 base::debug::Alias(&error); |
| 3050 bad_message::ReceivedBadMessage(process.get(), | 3057 bad_message::ReceivedBadMessage(process.get(), |
| 3051 bad_message::RPH_MOJO_PROCESS_ERROR); | 3058 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3052 } | 3059 } |
| 3053 | 3060 |
| 3054 } // namespace content | 3061 } // namespace content |
| OLD | NEW |