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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return NULL; | 75 return NULL; |
76 int id; | 76 int id; |
77 if (process->GetInteger("pid", &id) && id == static_cast<int>(pid)) | 77 if (process->GetInteger("pid", &id) && id == static_cast<int>(pid)) |
78 return process; | 78 return process; |
79 } | 79 } |
80 return NULL; | 80 return NULL; |
81 } | 81 } |
82 | 82 |
83 void GetAllWebContents(std::set<content::WebContents*>* web_contents) { | 83 void GetAllWebContents(std::set<content::WebContents*>* web_contents) { |
84 // Add all the existing WebContentses. | 84 // Add all the existing WebContentses. |
85 #if defined(OS_ANDROID) | 85 #if defined(OS_ANDROID) && !defined(USE_AURA) |
86 for (TabModelList::const_iterator iter = TabModelList::begin(); | 86 for (TabModelList::const_iterator iter = TabModelList::begin(); |
87 iter != TabModelList::end(); ++iter) { | 87 iter != TabModelList::end(); ++iter) { |
88 TabModel* model = *iter; | 88 TabModel* model = *iter; |
89 for (int i = 0; i < model->GetTabCount(); ++i) { | 89 for (int i = 0; i < model->GetTabCount(); ++i) { |
90 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); | 90 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); |
91 if (tab_web_contents) | 91 if (tab_web_contents) |
92 web_contents->insert(tab_web_contents); | 92 web_contents->insert(tab_web_contents); |
93 } | 93 } |
94 } | 94 } |
95 #else | 95 #else |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 scoped_refptr<ProcessDetails> process(new ProcessDetails( | 216 scoped_refptr<ProcessDetails> process(new ProcessDetails( |
217 base::Bind(&MemoryInternalsProxy::OnProcessAvailable, this))); | 217 base::Bind(&MemoryInternalsProxy::OnProcessAvailable, this))); |
218 process->StartFetch(MemoryDetails::FROM_CHROME_ONLY); | 218 process->StartFetch(MemoryDetails::FROM_CHROME_ONLY); |
219 } | 219 } |
220 | 220 |
221 MemoryInternalsProxy::~MemoryInternalsProxy() {} | 221 MemoryInternalsProxy::~MemoryInternalsProxy() {} |
222 | 222 |
223 void MemoryInternalsProxy::RequestRendererDetails() { | 223 void MemoryInternalsProxy::RequestRendererDetails() { |
224 renderer_details_->Clear(); | 224 renderer_details_->Clear(); |
225 | 225 |
226 #if defined(OS_ANDROID) | 226 #if defined(OS_ANDROID) && !defined(USE_AURA) |
227 for (TabModelList::const_iterator iter = TabModelList::begin(); | 227 for (TabModelList::const_iterator iter = TabModelList::begin(); |
228 iter != TabModelList::end(); ++iter) { | 228 iter != TabModelList::end(); ++iter) { |
229 TabModel* model = *iter; | 229 TabModel* model = *iter; |
230 for (int i = 0; i < model->GetTabCount(); ++i) { | 230 for (int i = 0; i < model->GetTabCount(); ++i) { |
231 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); | 231 content::WebContents* tab_web_contents = model->GetWebContentsAt(i); |
232 if (tab_web_contents) | 232 if (tab_web_contents) |
233 renderer_details_->AddWebContents(tab_web_contents); | 233 renderer_details_->AddWebContents(tab_web_contents); |
234 } | 234 } |
235 } | 235 } |
236 #else | 236 #else |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 const std::string& function, const base::Value& args) { | 360 const std::string& function, const base::Value& args) { |
361 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 361 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
362 | 362 |
363 std::vector<const base::Value*> args_vector(1, &args); | 363 std::vector<const base::Value*> args_vector(1, &args); |
364 base::string16 update = | 364 base::string16 update = |
365 content::WebUI::GetJavascriptCall(function, args_vector); | 365 content::WebUI::GetJavascriptCall(function, args_vector); |
366 // Don't forward updates to a destructed UI. | 366 // Don't forward updates to a destructed UI. |
367 if (handler_) | 367 if (handler_) |
368 handler_->OnUpdate(update); | 368 handler_->OnUpdate(update); |
369 } | 369 } |
OLD | NEW |