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

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

Issue 2094583002: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp Created 4 years, 6 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 26 matching lines...) Expand all
37 #include "base/strings/stringprintf.h" 37 #include "base/strings/stringprintf.h"
38 #include "base/supports_user_data.h" 38 #include "base/supports_user_data.h"
39 #include "base/sys_info.h" 39 #include "base/sys_info.h"
40 #include "base/threading/thread.h" 40 #include "base/threading/thread.h"
41 #include "base/threading/thread_restrictions.h" 41 #include "base/threading/thread_restrictions.h"
42 #include "base/threading/thread_task_runner_handle.h" 42 #include "base/threading/thread_task_runner_handle.h"
43 #include "base/trace_event/trace_event.h" 43 #include "base/trace_event/trace_event.h"
44 #include "base/tracked_objects.h" 44 #include "base/tracked_objects.h"
45 #include "build/build_config.h" 45 #include "build/build_config.h"
46 #include "cc/base/switches.h" 46 #include "cc/base/switches.h"
47 #include "components/memory_coordinator/browser/memory_state_notifier.h"
47 #include "components/scheduler/common/scheduler_switches.h" 48 #include "components/scheduler/common/scheduler_switches.h"
48 #include "components/tracing/common/tracing_switches.h" 49 #include "components/tracing/common/tracing_switches.h"
49 #include "content/browser/appcache/appcache_dispatcher_host.h" 50 #include "content/browser/appcache/appcache_dispatcher_host.h"
50 #include "content/browser/appcache/chrome_appcache_service.h" 51 #include "content/browser/appcache/chrome_appcache_service.h"
51 #include "content/browser/background_sync/background_sync_service_impl.h" 52 #include "content/browser/background_sync/background_sync_service_impl.h"
52 #include "content/browser/bad_message.h" 53 #include "content/browser/bad_message.h"
53 #include "content/browser/blob_storage/blob_dispatcher_host.h" 54 #include "content/browser/blob_storage/blob_dispatcher_host.h"
54 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 55 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
55 #include "content/browser/browser_child_process_host_impl.h" 56 #include "content/browser/browser_child_process_host_impl.h"
56 #include "content/browser/browser_main.h" 57 #include "content/browser/browser_main.h"
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 switches::kEnableExperimentalCanvasFeatures, 1398 switches::kEnableExperimentalCanvasFeatures,
1398 switches::kEnableExperimentalWebPlatformFeatures, 1399 switches::kEnableExperimentalWebPlatformFeatures,
1399 switches::kEnableHeapProfiling, 1400 switches::kEnableHeapProfiling,
1400 switches::kEnableGPUClientLogging, 1401 switches::kEnableGPUClientLogging,
1401 switches::kEnableGpuClientTracing, 1402 switches::kEnableGpuClientTracing,
1402 switches::kEnableGpuMemoryBufferVideoFrames, 1403 switches::kEnableGpuMemoryBufferVideoFrames,
1403 switches::kEnableGPUServiceLogging, 1404 switches::kEnableGPUServiceLogging,
1404 switches::kEnableIconNtp, 1405 switches::kEnableIconNtp,
1405 switches::kEnableLowResTiling, 1406 switches::kEnableLowResTiling,
1406 switches::kEnableMediaSuspend, 1407 switches::kEnableMediaSuspend,
1408 switches::kEnableMemoryCoordinator,
1407 switches::kEnableInbandTextTracks, 1409 switches::kEnableInbandTextTracks,
1408 switches::kEnableLCDText, 1410 switches::kEnableLCDText,
1409 switches::kEnableLogging, 1411 switches::kEnableLogging,
1410 switches::kEnableMemoryBenchmarking, 1412 switches::kEnableMemoryBenchmarking,
1411 switches::kEnableNetworkInformation, 1413 switches::kEnableNetworkInformation,
1412 switches::kEnableOverlayScrollbar, 1414 switches::kEnableOverlayScrollbar,
1413 switches::kEnablePinch, 1415 switches::kEnablePinch,
1414 switches::kEnablePluginPlaceholderTesting, 1416 switches::kEnablePluginPlaceholderTesting,
1415 switches::kEnablePreciseMemoryInfo, 1417 switches::kEnablePreciseMemoryInfo,
1416 switches::kEnablePreferCompositingToLCDText, 1418 switches::kEnablePreferCompositingToLCDText,
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 2551
2550 if (child_process_launcher_) { 2552 if (child_process_launcher_) {
2551 DCHECK(child_process_launcher_->GetProcess().IsValid()); 2553 DCHECK(child_process_launcher_->GetProcess().IsValid());
2552 DCHECK(!is_process_backgrounded_); 2554 DCHECK(!is_process_backgrounded_);
2553 2555
2554 if (mojo_child_connection_) { 2556 if (mojo_child_connection_) {
2555 mojo_child_connection_->SetProcessHandle( 2557 mojo_child_connection_->SetProcessHandle(
2556 child_process_launcher_->GetProcess().Handle()); 2558 child_process_launcher_->GetProcess().Handle());
2557 } 2559 }
2558 2560
2561 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2562 switches::kEnableMemoryCoordinator) &&
2563 mojo_application_host_) {
2564 memory_coordinator::mojom::ChildMemoryCoordinatorPtr coordinator;
2565 GetServiceRegistry()->ConnectToRemoteService(
2566 mojo::GetProxy(&coordinator));
2567 BrowserMainLoop::GetInstance()->memory_state_notifier()->AddChild(
2568 std::move(coordinator));
2569 }
2570
2559 // Not all platforms launch processes in the same backgrounded state. Make 2571 // Not all platforms launch processes in the same backgrounded state. Make
2560 // sure |is_process_backgrounded_| reflects this platform's initial process 2572 // sure |is_process_backgrounded_| reflects this platform's initial process
2561 // state. 2573 // state.
2562 is_process_backgrounded_ = 2574 is_process_backgrounded_ =
2563 child_process_launcher_->GetProcess().IsProcessBackgrounded(); 2575 child_process_launcher_->GetProcess().IsProcessBackgrounded();
2564 2576
2565 // Disable updating process priority on startup for now as it incorrectly 2577 // Disable updating process priority on startup for now as it incorrectly
2566 // results in backgrounding foreground navigations until their first commit 2578 // results in backgrounding foreground navigations until their first commit
2567 // is made. A better long term solution would be to be aware of the tab's 2579 // is made. A better long term solution would be to be aware of the tab's
2568 // visibility at this point. https://crbug.com/560446. 2580 // visibility at this point. https://crbug.com/560446.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2826 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2815 2827
2816 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2828 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2817 // enough information here so that we can determine what the bad message was. 2829 // enough information here so that we can determine what the bad message was.
2818 base::debug::Alias(&error); 2830 base::debug::Alias(&error);
2819 bad_message::ReceivedBadMessage(process.get(), 2831 bad_message::ReceivedBadMessage(process.get(),
2820 bad_message::RPH_MOJO_PROCESS_ERROR); 2832 bad_message::RPH_MOJO_PROCESS_ERROR);
2821 } 2833 }
2822 2834
2823 } // namespace content 2835 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698