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

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

Issue 2350423003: [Tentaive patch for discussion] Add Purge+Suspend metrics as UMA.
Patch Set: Fixed misuse of CanPurgeAndSuspend 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_purge_and_suspend_time_ = base::TimeTicks::FromInternalValue(0);
996 return true; 997 return true;
997 } 998 }
998 999
999 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( 1000 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
1000 const std::string& channel_id) { 1001 const std::string& channel_id) {
1001 scoped_refptr<base::SingleThreadTaskRunner> runner = 1002 scoped_refptr<base::SingleThreadTaskRunner> runner =
1002 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 1003 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
1003 IPC::mojom::ChannelBootstrapPtr bootstrap; 1004 IPC::mojom::ChannelBootstrapPtr bootstrap;
1004 GetRemoteInterfaces()->GetInterface(&bootstrap); 1005 GetRemoteInterfaces()->GetInterface(&bootstrap);
1005 std::unique_ptr<IPC::ChannelFactory> channel_factory = 1006 std::unique_ptr<IPC::ChannelFactory> channel_factory =
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 Cleanup(); 1422 Cleanup();
1422 } 1423 }
1423 1424
1424 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { 1425 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() {
1425 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1426 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1426 return is_worker_ref_count_disabled_; 1427 return is_worker_ref_count_disabled_;
1427 } 1428 }
1428 1429
1429 void RenderProcessHostImpl::PurgeAndSuspend() { 1430 void RenderProcessHostImpl::PurgeAndSuspend() {
1430 Send(new ChildProcessMsg_PurgeAndSuspend()); 1431 Send(new ChildProcessMsg_PurgeAndSuspend());
1432 last_purge_and_suspend_time_ = base::TimeTicks::Now();
1433 }
1434
1435 const base::TimeTicks& RenderProcessHostImpl::GetLastPurgeAndSuspendTime()
1436 const {
1437 return last_purge_and_suspend_time_;
1431 } 1438 }
1432 1439
1433 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { 1440 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() {
1434 if (!remote_route_provider_) { 1441 if (!remote_route_provider_) {
1435 DCHECK(channel_); 1442 DCHECK(channel_);
1436 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); 1443 channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
1437 } 1444 }
1438 return remote_route_provider_.get(); 1445 return remote_route_provider_.get();
1439 } 1446 }
1440 1447
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3041 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3035 3042
3036 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3043 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3037 // enough information here so that we can determine what the bad message was. 3044 // enough information here so that we can determine what the bad message was.
3038 base::debug::Alias(&error); 3045 base::debug::Alias(&error);
3039 bad_message::ReceivedBadMessage(process.get(), 3046 bad_message::ReceivedBadMessage(process.get(),
3040 bad_message::RPH_MOJO_PROCESS_ERROR); 3047 bad_message::RPH_MOJO_PROCESS_ERROR);
3041 } 3048 }
3042 3049
3043 } // namespace content 3050 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/child/child_discardable_shared_memory_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698