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 26 matching lines...) Expand all Loading... |
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 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 | 2555 |
2555 if (child_process_launcher_) { | 2556 if (child_process_launcher_) { |
2556 DCHECK(child_process_launcher_->GetProcess().IsValid()); | 2557 DCHECK(child_process_launcher_->GetProcess().IsValid()); |
2557 DCHECK(!is_process_backgrounded_); | 2558 DCHECK(!is_process_backgrounded_); |
2558 | 2559 |
2559 if (mojo_child_connection_) { | 2560 if (mojo_child_connection_) { |
2560 mojo_child_connection_->SetProcessHandle( | 2561 mojo_child_connection_->SetProcessHandle( |
2561 child_process_launcher_->GetProcess().Handle()); | 2562 child_process_launcher_->GetProcess().Handle()); |
2562 } | 2563 } |
2563 | 2564 |
| 2565 if (memory_coordinator::IsEnabled() && mojo_application_host_) { |
| 2566 memory_coordinator::mojom::ChildMemoryCoordinatorPtr coordinator; |
| 2567 GetRemoteInterfaces()->GetInterface(&coordinator); |
| 2568 BrowserMainLoop::GetInstance()->memory_state_notifier()->AddChild( |
| 2569 std::move(coordinator)); |
| 2570 } |
| 2571 |
2564 // Not all platforms launch processes in the same backgrounded state. Make | 2572 // Not all platforms launch processes in the same backgrounded state. Make |
2565 // sure |is_process_backgrounded_| reflects this platform's initial process | 2573 // sure |is_process_backgrounded_| reflects this platform's initial process |
2566 // state. | 2574 // state. |
2567 is_process_backgrounded_ = | 2575 is_process_backgrounded_ = |
2568 child_process_launcher_->GetProcess().IsProcessBackgrounded(); | 2576 child_process_launcher_->GetProcess().IsProcessBackgrounded(); |
2569 | 2577 |
2570 // Disable updating process priority on startup for now as it incorrectly | 2578 // Disable updating process priority on startup for now as it incorrectly |
2571 // results in backgrounding foreground navigations until their first commit | 2579 // results in backgrounding foreground navigations until their first commit |
2572 // is made. A better long term solution would be to be aware of the tab's | 2580 // is made. A better long term solution would be to be aware of the tab's |
2573 // visibility at this point. https://crbug.com/560446. | 2581 // visibility at this point. https://crbug.com/560446. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2827 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2820 | 2828 |
2821 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2829 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2822 // enough information here so that we can determine what the bad message was. | 2830 // enough information here so that we can determine what the bad message was. |
2823 base::debug::Alias(&error); | 2831 base::debug::Alias(&error); |
2824 bad_message::ReceivedBadMessage(process.get(), | 2832 bad_message::ReceivedBadMessage(process.get(), |
2825 bad_message::RPH_MOJO_PROCESS_ERROR); | 2833 bad_message::RPH_MOJO_PROCESS_ERROR); |
2826 } | 2834 } |
2827 | 2835 |
2828 } // namespace content | 2836 } // namespace content |
OLD | NEW |