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

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: Fixed comment. 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 const std::string& channel_id) { 999 const std::string& channel_id) {
998 scoped_refptr<base::SingleThreadTaskRunner> runner = 1000 scoped_refptr<base::SingleThreadTaskRunner> runner =
999 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 1001 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
1000 IPC::mojom::ChannelBootstrapPtr bootstrap; 1002 IPC::mojom::ChannelBootstrapPtr bootstrap;
1001 GetRemoteInterfaces()->GetInterface(&bootstrap); 1003 GetRemoteInterfaces()->GetInterface(&bootstrap);
1002 std::unique_ptr<IPC::ChannelFactory> channel_factory = 1004 std::unique_ptr<IPC::ChannelFactory> channel_factory =
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 Cleanup(); 1405 Cleanup();
1404 } 1406 }
1405 1407
1406 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { 1408 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() {
1407 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1409 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1408 return is_worker_ref_count_disabled_; 1410 return is_worker_ref_count_disabled_;
1409 } 1411 }
1410 1412
1411 void RenderProcessHostImpl::PurgeAndSuspend() { 1413 void RenderProcessHostImpl::PurgeAndSuspend() {
1412 Send(new ChildProcessMsg_PurgeAndSuspend()); 1414 Send(new ChildProcessMsg_PurgeAndSuspend());
1415 last_purged_and_suspended_time_ = base::TimeTicks::Now();
1416 }
1417
1418 void RenderProcessHostImpl::Resume() {
1419 Send(new ChildProcessMsg_Resume());
1420 last_resumed_in_background_time_ = base::TimeTicks::Now();
1421 }
1422
1423 const base::TimeTicks& RenderProcessHostImpl::GetLastPurgedAndSuspendedTime()
1424 const {
1425 return last_purged_and_suspended_time_;
1426 }
1427
1428 const base::TimeTicks& RenderProcessHostImpl::GetLastResumedInBackgroundTime()
1429 const {
1430 return last_resumed_in_background_time_;
1413 } 1431 }
1414 1432
1415 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { 1433 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() {
1416 if (!remote_route_provider_) { 1434 if (!remote_route_provider_) {
1417 DCHECK(channel_); 1435 DCHECK(channel_);
1418 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); 1436 channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
1419 } 1437 }
1420 return remote_route_provider_.get(); 1438 return remote_route_provider_.get();
1421 } 1439 }
1422 1440
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3045 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3028 3046
3029 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3047 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3030 // enough information here so that we can determine what the bad message was. 3048 // enough information here so that we can determine what the bad message was.
3031 base::debug::Alias(&error); 3049 base::debug::Alias(&error);
3032 bad_message::ReceivedBadMessage(process.get(), 3050 bad_message::ReceivedBadMessage(process.get(),
3033 bad_message::RPH_MOJO_PROCESS_ERROR); 3051 bad_message::RPH_MOJO_PROCESS_ERROR);
3034 } 3052 }
3035 3053
3036 } // namespace content 3054 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698