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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2387603003: Resume a backgrounded renderer that was purged and suspended (Closed)
Patch Set: Use constexpr base::TimeDelta Created 4 years, 2 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 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 983
984 if (!gpu_observer_registered_) { 984 if (!gpu_observer_registered_) {
985 gpu_observer_registered_ = true; 985 gpu_observer_registered_ = true;
986 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); 986 ui::GpuSwitchingManager::GetInstance()->AddObserver(this);
987 } 987 }
988 988
989 power_monitor_broadcaster_.Init(); 989 power_monitor_broadcaster_.Init();
990 990
991 is_initialized_ = true; 991 is_initialized_ = true;
992 init_time_ = base::TimeTicks::Now(); 992 init_time_ = base::TimeTicks::Now();
993 last_purged_and_suspended_time_ = base::TimeTicks::FromInternalValue(0);
994 last_resumed_in_background_time_ = last_purged_and_suspended_time_;
993 return true; 995 return true;
994 } 996 }
995 997
996 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy() { 998 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy() {
997 scoped_refptr<base::SingleThreadTaskRunner> runner = 999 scoped_refptr<base::SingleThreadTaskRunner> runner =
998 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 1000 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
999 IPC::mojom::ChannelBootstrapPtr bootstrap; 1001 IPC::mojom::ChannelBootstrapPtr bootstrap;
1000 GetRemoteInterfaces()->GetInterface(&bootstrap); 1002 GetRemoteInterfaces()->GetInterface(&bootstrap);
1001 std::unique_ptr<IPC::ChannelFactory> channel_factory = 1003 std::unique_ptr<IPC::ChannelFactory> channel_factory =
1002 IPC::ChannelMojo::CreateServerFactory( 1004 IPC::ChannelMojo::CreateServerFactory(
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 Cleanup(); 1404 Cleanup();
1403 } 1405 }
1404 1406
1405 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { 1407 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() {
1406 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1408 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1407 return is_worker_ref_count_disabled_; 1409 return is_worker_ref_count_disabled_;
1408 } 1410 }
1409 1411
1410 void RenderProcessHostImpl::PurgeAndSuspend() { 1412 void RenderProcessHostImpl::PurgeAndSuspend() {
1411 Send(new ChildProcessMsg_PurgeAndSuspend()); 1413 Send(new ChildProcessMsg_PurgeAndSuspend());
1414 last_purged_and_suspended_time_ = base::TimeTicks::Now();
1415 }
1416
1417 void RenderProcessHostImpl::Resume() {
1418 Send(new ChildProcessMsg_Resume());
1419 last_resumed_in_background_time_ = base::TimeTicks::Now();
1420 }
1421
1422 const base::TimeTicks& RenderProcessHostImpl::GetLastPurgedAndSuspendedTime()
1423 const {
1424 return last_purged_and_suspended_time_;
1425 }
1426
1427 const base::TimeTicks& RenderProcessHostImpl::GetLastResumedInBackgroundTime()
1428 const {
1429 return last_resumed_in_background_time_;
1412 } 1430 }
1413 1431
1414 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { 1432 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() {
1415 return remote_route_provider_.get(); 1433 return remote_route_provider_.get();
1416 } 1434 }
1417 1435
1418 // static 1436 // static
1419 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface( 1437 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface(
1420 RenderProcessHost* host) { 1438 RenderProcessHost* host) {
1421 AssociatedInterfaceHolder<mojom::Renderer>* holder = 1439 AssociatedInterfaceHolder<mojom::Renderer>* holder =
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3049 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3032 3050
3033 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3051 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3034 // enough information here so that we can determine what the bad message was. 3052 // enough information here so that we can determine what the bad message was.
3035 base::debug::Alias(&error); 3053 base::debug::Alias(&error);
3036 bad_message::ReceivedBadMessage(render_process_id, 3054 bad_message::ReceivedBadMessage(render_process_id,
3037 bad_message::RPH_MOJO_PROCESS_ERROR); 3055 bad_message::RPH_MOJO_PROCESS_ERROR);
3038 } 3056 }
3039 3057
3040 } // namespace content 3058 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698