| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/memory_details.h" | 5 #include "chrome/browser/memory_details.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/browser_child_process_host_iterator.h" | 22 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/child_process_data.h" | 24 #include "content/public/browser/child_process_data.h" |
| 25 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/navigation_entry.h" | 26 #include "content/public/browser/navigation_entry.h" |
| 27 #include "content/public/browser/render_frame_host.h" | 27 #include "content/public/browser/render_frame_host.h" |
| 28 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
| 29 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
| 30 #include "content/public/browser/render_widget_host.h" | 30 #include "content/public/browser/render_widget_host.h" |
| 31 #include "content/public/browser/render_widget_host_iterator.h" | 31 #include "content/public/browser/render_widget_host_iterator.h" |
| 32 #include "content/public/browser/render_widget_host_view.h" |
| 32 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/common/bindings_policy.h" | 34 #include "content/public/common/bindings_policy.h" |
| 34 #include "content/public/common/content_constants.h" | 35 #include "content/public/common/content_constants.h" |
| 35 #include "extensions/features/features.h" | 36 #include "extensions/features/features.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 37 | 38 |
| 38 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 39 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 39 #include "content/public/browser/zygote_host_linux.h" | 40 #include "content/public/browser/zygote_host_linux.h" |
| 40 #endif | 41 #endif |
| 41 | 42 |
| 42 #if BUILDFLAG(ENABLE_EXTENSIONS) | 43 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 43 #include "extensions/browser/extension_registry.h" | 44 #include "extensions/browser/extension_registry.h" |
| 44 #include "extensions/browser/process_manager.h" | 45 #include "extensions/browser/process_manager.h" |
| 45 #include "extensions/browser/process_map.h" | 46 #include "extensions/browser/process_map.h" |
| 46 #include "extensions/browser/view_type_utils.h" | 47 #include "extensions/browser/view_type_utils.h" |
| 47 #include "extensions/common/extension.h" | 48 #include "extensions/common/extension.h" |
| 48 #endif | 49 #endif |
| 49 | 50 |
| 50 using base::StringPrintf; | 51 using base::StringPrintf; |
| 51 using content::BrowserChildProcessHostIterator; | 52 using content::BrowserChildProcessHostIterator; |
| 52 using content::BrowserThread; | 53 using content::BrowserThread; |
| 53 using content::NavigationEntry; | 54 using content::NavigationEntry; |
| 54 using content::RenderViewHost; | 55 using content::RenderViewHost; |
| 55 using content::RenderWidgetHost; | 56 using content::RenderWidgetHost; |
| 57 using content::RenderWidgetHostView; |
| 56 using content::WebContents; | 58 using content::WebContents; |
| 57 #if BUILDFLAG(ENABLE_EXTENSIONS) | 59 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 58 using extensions::Extension; | 60 using extensions::Extension; |
| 59 #endif | 61 #endif |
| 60 | 62 |
| 61 // static | 63 // static |
| 62 std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( | 64 std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( |
| 63 RendererProcessType type) { | 65 RendererProcessType type) { |
| 64 switch (type) { | 66 switch (type) { |
| 65 case RENDERER_NORMAL: | 67 case RENDERER_NORMAL: |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 271 } |
| 270 } | 272 } |
| 271 #endif | 273 #endif |
| 272 | 274 |
| 273 // Use the list of widgets to iterate over the WebContents instances whose | 275 // Use the list of widgets to iterate over the WebContents instances whose |
| 274 // main RenderFrameHosts are in |process|. Refine our determination of the | 276 // main RenderFrameHosts are in |process|. Refine our determination of the |
| 275 // |process.renderer_type|, and record the page titles. | 277 // |process.renderer_type|, and record the page titles. |
| 276 for (content::RenderWidgetHost* widget : widgets_by_pid[process.pid]) { | 278 for (content::RenderWidgetHost* widget : widgets_by_pid[process.pid]) { |
| 277 DCHECK_EQ(render_process_host, widget->GetProcess()); | 279 DCHECK_EQ(render_process_host, widget->GetProcess()); |
| 278 | 280 |
| 281 RenderWidgetHostView* rwhv = widget->GetView(); |
| 282 if (rwhv && rwhv->IsRenderWidgetHostViewChildFrame()) |
| 283 process.contains_oopif = true; |
| 284 |
| 279 RenderViewHost* rvh = RenderViewHost::From(widget); | 285 RenderViewHost* rvh = RenderViewHost::From(widget); |
| 280 if (!rvh) | 286 if (!rvh) |
| 281 continue; | 287 continue; |
| 282 | 288 |
| 283 WebContents* contents = WebContents::FromRenderViewHost(rvh); | 289 WebContents* contents = WebContents::FromRenderViewHost(rvh); |
| 284 | 290 |
| 285 // Assume that an RVH without a web contents is an interstitial. | 291 // Assume that an RVH without a web contents is an interstitial. |
| 286 if (!contents) { | 292 if (!contents) { |
| 287 process.renderer_type = ProcessMemoryInformation::RENDERER_INTERSTITIAL; | 293 process.renderer_type = ProcessMemoryInformation::RENDERER_INTERSTITIAL; |
| 288 continue; | 294 continue; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // Get rid of other Chrome processes that are from a different profile. | 353 // Get rid of other Chrome processes that are from a different profile. |
| 348 auto is_unknown = [](ProcessMemoryInformation& process) { | 354 auto is_unknown = [](ProcessMemoryInformation& process) { |
| 349 return process.process_type == content::PROCESS_TYPE_UNKNOWN; | 355 return process.process_type == content::PROCESS_TYPE_UNKNOWN; |
| 350 }; | 356 }; |
| 351 auto& vector = chrome_browser->processes; | 357 auto& vector = chrome_browser->processes; |
| 352 vector.erase(std::remove_if(vector.begin(), vector.end(), is_unknown), | 358 vector.erase(std::remove_if(vector.begin(), vector.end(), is_unknown), |
| 353 vector.end()); | 359 vector.end()); |
| 354 | 360 |
| 355 OnDetailsAvailable(); | 361 OnDetailsAvailable(); |
| 356 } | 362 } |
| OLD | NEW |