Chromium Code Reviews| 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 | 986 |
| 987 if (!gpu_observer_registered_) { | 987 if (!gpu_observer_registered_) { |
| 988 gpu_observer_registered_ = true; | 988 gpu_observer_registered_ = true; |
| 989 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 989 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
| 990 } | 990 } |
| 991 | 991 |
| 992 power_monitor_broadcaster_.Init(); | 992 power_monitor_broadcaster_.Init(); |
| 993 | 993 |
| 994 is_initialized_ = true; | 994 is_initialized_ = true; |
| 995 init_time_ = base::TimeTicks::Now(); | 995 init_time_ = base::TimeTicks::Now(); |
| 996 last_purged_and_suspended_time_ = base::TimeTicks::FromInternalValue(0); | |
| 997 last_resumed_time_ = last_purged_and_suspended_time_; | |
|
hajimehoshi
2016/09/30 11:22:46
Is this updated when the tab is foregrounded and r
tasak
2016/10/03 05:44:16
No. This is only updated when the tab is backgroun
| |
| 996 return true; | 998 return true; |
| 997 } | 999 } |
| 998 | 1000 |
| 999 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( | 1001 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( |
| 1000 const std::string& channel_id) { | 1002 const std::string& channel_id) { |
| 1001 scoped_refptr<base::SingleThreadTaskRunner> runner = | 1003 scoped_refptr<base::SingleThreadTaskRunner> runner = |
| 1002 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 1004 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
| 1003 IPC::mojom::ChannelBootstrapPtr bootstrap; | 1005 IPC::mojom::ChannelBootstrapPtr bootstrap; |
| 1004 GetRemoteInterfaces()->GetInterface(&bootstrap); | 1006 GetRemoteInterfaces()->GetInterface(&bootstrap); |
| 1005 std::unique_ptr<IPC::ChannelFactory> channel_factory = | 1007 std::unique_ptr<IPC::ChannelFactory> channel_factory = |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1421 Cleanup(); | 1423 Cleanup(); |
| 1422 } | 1424 } |
| 1423 | 1425 |
| 1424 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { | 1426 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { |
| 1425 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1427 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1426 return is_worker_ref_count_disabled_; | 1428 return is_worker_ref_count_disabled_; |
| 1427 } | 1429 } |
| 1428 | 1430 |
| 1429 void RenderProcessHostImpl::PurgeAndSuspend() { | 1431 void RenderProcessHostImpl::PurgeAndSuspend() { |
| 1430 Send(new ChildProcessMsg_PurgeAndSuspend()); | 1432 Send(new ChildProcessMsg_PurgeAndSuspend()); |
| 1433 last_purged_and_suspended_time_ = base::TimeTicks::Now(); | |
| 1434 } | |
| 1435 | |
| 1436 void RenderProcessHostImpl::Resume() { | |
| 1437 Send(new ChildProcessMsg_Resume()); | |
| 1438 last_resumed_time_ = base::TimeTicks::Now(); | |
| 1439 } | |
| 1440 | |
| 1441 const base::TimeTicks& RenderProcessHostImpl::GetLastPurgedAndSuspendedTime() | |
| 1442 const { | |
| 1443 return last_purged_and_suspended_time_; | |
| 1444 } | |
| 1445 | |
| 1446 const base::TimeTicks& RenderProcessHostImpl::GetLastResumedTime() const { | |
| 1447 return last_resumed_time_; | |
| 1431 } | 1448 } |
| 1432 | 1449 |
| 1433 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { | 1450 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { |
| 1434 if (!remote_route_provider_) { | 1451 if (!remote_route_provider_) { |
| 1435 DCHECK(channel_); | 1452 DCHECK(channel_); |
| 1436 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); | 1453 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); |
| 1437 } | 1454 } |
| 1438 return remote_route_provider_.get(); | 1455 return remote_route_provider_.get(); |
| 1439 } | 1456 } |
| 1440 | 1457 |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3034 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3051 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3035 | 3052 |
| 3036 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3053 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 3037 // enough information here so that we can determine what the bad message was. | 3054 // enough information here so that we can determine what the bad message was. |
| 3038 base::debug::Alias(&error); | 3055 base::debug::Alias(&error); |
| 3039 bad_message::ReceivedBadMessage(process.get(), | 3056 bad_message::ReceivedBadMessage(process.get(), |
| 3040 bad_message::RPH_MOJO_PROCESS_ERROR); | 3057 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3041 } | 3058 } |
| 3042 | 3059 |
| 3043 } // namespace content | 3060 } // namespace content |
| OLD | NEW |