| 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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 | 918 |
| 919 if (!gpu_observer_registered_) { | 919 if (!gpu_observer_registered_) { |
| 920 gpu_observer_registered_ = true; | 920 gpu_observer_registered_ = true; |
| 921 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 921 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
| 922 } | 922 } |
| 923 | 923 |
| 924 power_monitor_broadcaster_.Init(); | 924 power_monitor_broadcaster_.Init(); |
| 925 | 925 |
| 926 is_initialized_ = true; | 926 is_initialized_ = true; |
| 927 init_time_ = base::TimeTicks::Now(); | 927 init_time_ = base::TimeTicks::Now(); |
| 928 last_purged_and_suspended_time_ = base::TimeTicks::FromInternalValue(0); |
| 929 last_resumed_in_background_time_ = last_purged_and_suspended_time_; |
| 928 return true; | 930 return true; |
| 929 } | 931 } |
| 930 | 932 |
| 931 void RenderProcessHostImpl::InitializeChannelProxy() { | 933 void RenderProcessHostImpl::InitializeChannelProxy() { |
| 932 // Generate a token used to identify the new child process. | 934 // Generate a token used to identify the new child process. |
| 933 child_token_ = mojo::edk::GenerateRandomToken(); | 935 child_token_ = mojo::edk::GenerateRandomToken(); |
| 934 | 936 |
| 935 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 937 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
| 936 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 938 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
| 937 | 939 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 Cleanup(); | 1406 Cleanup(); |
| 1405 } | 1407 } |
| 1406 | 1408 |
| 1407 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { | 1409 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { |
| 1408 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1410 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1409 return is_worker_ref_count_disabled_; | 1411 return is_worker_ref_count_disabled_; |
| 1410 } | 1412 } |
| 1411 | 1413 |
| 1412 void RenderProcessHostImpl::PurgeAndSuspend() { | 1414 void RenderProcessHostImpl::PurgeAndSuspend() { |
| 1413 Send(new ChildProcessMsg_PurgeAndSuspend()); | 1415 Send(new ChildProcessMsg_PurgeAndSuspend()); |
| 1416 last_purged_and_suspended_time_ = base::TimeTicks::Now(); |
| 1417 } |
| 1418 |
| 1419 void RenderProcessHostImpl::Resume() { |
| 1420 Send(new ChildProcessMsg_Resume()); |
| 1421 last_resumed_in_background_time_ = base::TimeTicks::Now(); |
| 1422 } |
| 1423 |
| 1424 const base::TimeTicks& RenderProcessHostImpl::GetLastPurgedAndSuspendedTime() |
| 1425 const { |
| 1426 return last_purged_and_suspended_time_; |
| 1427 } |
| 1428 |
| 1429 const base::TimeTicks& RenderProcessHostImpl::GetLastResumedInBackgroundTime() |
| 1430 const { |
| 1431 return last_resumed_in_background_time_; |
| 1414 } | 1432 } |
| 1415 | 1433 |
| 1416 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { | 1434 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { |
| 1417 return renderer_interface_.get(); | 1435 return renderer_interface_.get(); |
| 1418 } | 1436 } |
| 1419 | 1437 |
| 1420 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { | 1438 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { |
| 1421 return remote_route_provider_.get(); | 1439 return remote_route_provider_.get(); |
| 1422 } | 1440 } |
| 1423 | 1441 |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3002 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3020 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3003 | 3021 |
| 3004 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3022 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 3005 // enough information here so that we can determine what the bad message was. | 3023 // enough information here so that we can determine what the bad message was. |
| 3006 base::debug::Alias(&error); | 3024 base::debug::Alias(&error); |
| 3007 bad_message::ReceivedBadMessage(render_process_id, | 3025 bad_message::ReceivedBadMessage(render_process_id, |
| 3008 bad_message::RPH_MOJO_PROCESS_ERROR); | 3026 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3009 } | 3027 } |
| 3010 | 3028 |
| 3011 } // namespace content | 3029 } // namespace content |
| OLD | NEW |