| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 void AddWebContents(content::WebContents* content) { | 147 void AddWebContents(content::WebContents* content) { |
| 148 web_contents_.insert(content); | 148 web_contents_.insert(content); |
| 149 | 149 |
| 150 auto rph = content->GetRenderViewHost()->GetProcess(); | 150 auto rph = content->GetRenderViewHost()->GetProcess(); |
| 151 content::ServiceRegistry* service_registry = rph->GetServiceRegistry(); | 151 content::ServiceRegistry* service_registry = rph->GetServiceRegistry(); |
| 152 ResourceUsageReporterPtr service; | 152 ResourceUsageReporterPtr service; |
| 153 if (service_registry) | 153 if (service_registry) |
| 154 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); | 154 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); |
| 155 resource_usage_reporters_.insert(std::make_pair( | 155 resource_usage_reporters_.insert(std::make_pair( |
| 156 content, make_linked_ptr(new ProcessResourceUsage(service.Pass())))); | 156 content, |
| 157 make_linked_ptr(new ProcessResourceUsage(std::move(service))))); |
| 157 DCHECK_EQ(web_contents_.size(), resource_usage_reporters_.size()); | 158 DCHECK_EQ(web_contents_.size(), resource_usage_reporters_.size()); |
| 158 } | 159 } |
| 159 | 160 |
| 160 void Clear() { | 161 void Clear() { |
| 161 web_contents_.clear(); | 162 web_contents_.clear(); |
| 162 resource_usage_reporters_.clear(); | 163 resource_usage_reporters_.clear(); |
| 163 weak_factory_.InvalidateWeakPtrs(); | 164 weak_factory_.InvalidateWeakPtrs(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void RemoveWebContents(base::ProcessId) { | 167 void RemoveWebContents(base::ProcessId) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 const std::string& function, const base::Value& args) { | 363 const std::string& function, const base::Value& args) { |
| 363 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 364 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 364 | 365 |
| 365 std::vector<const base::Value*> args_vector(1, &args); | 366 std::vector<const base::Value*> args_vector(1, &args); |
| 366 base::string16 update = | 367 base::string16 update = |
| 367 content::WebUI::GetJavascriptCall(function, args_vector); | 368 content::WebUI::GetJavascriptCall(function, args_vector); |
| 368 // Don't forward updates to a destructed UI. | 369 // Don't forward updates to a destructed UI. |
| 369 if (handler_) | 370 if (handler_) |
| 370 handler_->OnUpdate(update); | 371 handler_->OnUpdate(update); |
| 371 } | 372 } |
| OLD | NEW |