| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/memory_internals/memory_internals_proxy.h" | 5 #include "chrome/browser/ui/webui/memory_internals/memory_internals_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/process_resource_usage.h" | 24 #include "chrome/browser/process_resource_usage.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 27 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 27 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 28 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 28 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 29 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 29 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_iterator.h" | 31 #include "chrome/browser/ui/browser_iterator.h" |
| 32 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 32 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 33 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h" | 33 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h" |
| 34 #include "chrome/common/features.h" |
| 34 #include "content/public/browser/navigation_controller.h" | 35 #include "content/public/browser/navigation_controller.h" |
| 35 #include "content/public/browser/navigation_entry.h" | 36 #include "content/public/browser/navigation_entry.h" |
| 36 #include "content/public/browser/render_process_host.h" | 37 #include "content/public/browser/render_process_host.h" |
| 37 #include "content/public/browser/render_view_host.h" | 38 #include "content/public/browser/render_view_host.h" |
| 38 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/browser/web_ui.h" | 40 #include "content/public/browser/web_ui.h" |
| 40 #include "content/public/common/service_registry.h" | 41 #include "content/public/common/service_registry.h" |
| 41 | 42 |
| 42 #if defined(ENABLE_PRINT_PREVIEW) | 43 #if defined(ENABLE_PRINT_PREVIEW) |
| 43 #include "chrome/browser/printing/background_printing_manager.h" | 44 #include "chrome/browser/printing/background_printing_manager.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return NULL; | 76 return NULL; |
| 76 int id; | 77 int id; |
| 77 if (process->GetInteger("pid", &id) && id == static_cast<int>(pid)) | 78 if (process->GetInteger("pid", &id) && id == static_cast<int>(pid)) |
| 78 return process; | 79 return process; |
| 79 } | 80 } |
| 80 return NULL; | 81 return NULL; |
| 81 } | 82 } |
| 82 | 83 |
| 83 void GetAllWebContents(std::set<content::WebContents*>* web_contents) { | 84 void GetAllWebContents(std::set<content::WebContents*>* web_contents) { |
| 84 // Add all the existing WebContentses. | 85 // Add all the existing WebContentses. |
| 85 #if defined(OS_ANDROID) | 86 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 86 for (TabModelList::const_iterator iter = TabModelList::begin(); | 87 for (TabModelList::const_iterator iter = TabModelList::begin(); |
| 87 iter != TabModelList::end(); ++iter) { | 88 iter != TabModelList::end(); ++iter) { |
| 88 TabModel* model = *iter; | 89 TabModel* model = *iter; |
| 89 for (int i = 0; i < model->GetTabCount(); ++i) { | 90 for (int i = 0; i < model->GetTabCount(); ++i) { |
| 90 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); | 91 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); |
| 91 if (tab_web_contents) | 92 if (tab_web_contents) |
| 92 web_contents->insert(tab_web_contents); | 93 web_contents->insert(tab_web_contents); |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 #else | 96 #else |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 scoped_refptr<ProcessDetails> process(new ProcessDetails( | 217 scoped_refptr<ProcessDetails> process(new ProcessDetails( |
| 217 base::Bind(&MemoryInternalsProxy::OnProcessAvailable, this))); | 218 base::Bind(&MemoryInternalsProxy::OnProcessAvailable, this))); |
| 218 process->StartFetch(MemoryDetails::FROM_CHROME_ONLY); | 219 process->StartFetch(MemoryDetails::FROM_CHROME_ONLY); |
| 219 } | 220 } |
| 220 | 221 |
| 221 MemoryInternalsProxy::~MemoryInternalsProxy() {} | 222 MemoryInternalsProxy::~MemoryInternalsProxy() {} |
| 222 | 223 |
| 223 void MemoryInternalsProxy::RequestRendererDetails() { | 224 void MemoryInternalsProxy::RequestRendererDetails() { |
| 224 renderer_details_->Clear(); | 225 renderer_details_->Clear(); |
| 225 | 226 |
| 226 #if defined(OS_ANDROID) | 227 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 227 for (TabModelList::const_iterator iter = TabModelList::begin(); | 228 for (TabModelList::const_iterator iter = TabModelList::begin(); |
| 228 iter != TabModelList::end(); ++iter) { | 229 iter != TabModelList::end(); ++iter) { |
| 229 TabModel* model = *iter; | 230 TabModel* model = *iter; |
| 230 for (int i = 0; i < model->GetTabCount(); ++i) { | 231 for (int i = 0; i < model->GetTabCount(); ++i) { |
| 231 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); | 232 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); |
| 232 if (tab_web_contents) | 233 if (tab_web_contents) |
| 233 renderer_details_->AddWebContents(tab_web_contents); | 234 renderer_details_->AddWebContents(tab_web_contents); |
| 234 } | 235 } |
| 235 } | 236 } |
| 236 #else | 237 #else |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 const std::string& function, const base::Value& args) { | 361 const std::string& function, const base::Value& args) { |
| 361 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 362 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 362 | 363 |
| 363 std::vector<const base::Value*> args_vector(1, &args); | 364 std::vector<const base::Value*> args_vector(1, &args); |
| 364 base::string16 update = | 365 base::string16 update = |
| 365 content::WebUI::GetJavascriptCall(function, args_vector); | 366 content::WebUI::GetJavascriptCall(function, args_vector); |
| 366 // Don't forward updates to a destructed UI. | 367 // Don't forward updates to a destructed UI. |
| 367 if (handler_) | 368 if (handler_) |
| 368 handler_->OnUpdate(update); | 369 handler_->OnUpdate(update); |
| 369 } | 370 } |
| OLD | NEW |