Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/task_manager/task_manager.cc

Issue 6328010: Fix Task Manager to correctly display network usage of plug-in processes. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix the way Task Manager accounts for network usage by plug-ins. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/task_manager/task_manager.h" 5 #include "chrome/browser/task_manager/task_manager.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/i18n/number_formatting.h" 8 #include "base/i18n/number_formatting.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 param.routing_id); 844 param.routing_id);
845 if (resource) 845 if (resource)
846 break; 846 break;
847 } 847 }
848 848
849 if (resource == NULL) { 849 if (resource == NULL) {
850 // We can't match a resource to the notification. That might mean the 850 // We can't match a resource to the notification. That might mean the
851 // tab that started a download was closed, or the request may have had 851 // tab that started a download was closed, or the request may have had
852 // no originating resource associated with it in the first place. 852 // no originating resource associated with it in the first place.
853 // We attribute orphaned/unaccounted activity to the Browser process. 853 // We attribute orphaned/unaccounted activity to the Browser process.
854 int browser_pid = base::GetCurrentProcId(); 854 // TODO(wez): Better results could be achieved by checking with the
855 CHECK(param.origin_child_id != browser_pid); 855 // ResourceProviders in decreasing order of specialisation, with the
856 param.origin_child_id = browser_pid; 856 // Renderer and Browser resources last, so that fall-back is implicit.
857 param.render_process_host_child_id = param.routing_id = -1; 857 CHECK(param.origin_child_id != (-1));
858 param.origin_child_id =
859 param.render_process_host_child_id =
860 param.routing_id = -1;
858 BytesRead(param); 861 BytesRead(param);
859 return; 862 return;
860 } 863 }
861 864
862 // We do support network usage, mark the resource as such so it can report 0 865 // We do support network usage, mark the resource as such so it can report 0
863 // instead of N/A. 866 // instead of N/A.
864 if (!resource->SupportNetworkUsage()) 867 if (!resource->SupportNetworkUsage())
865 resource->SetSupportNetworkUsage(); 868 resource->SetSupportNetworkUsage();
866 869
867 ResourceValueMap::const_iterator iter_res = 870 ResourceValueMap::const_iterator iter_res =
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 MetricsMap::const_iterator iter = metrics_map_.find(handle); 1041 MetricsMap::const_iterator iter = metrics_map_.find(handle);
1039 if (iter == metrics_map_.end()) 1042 if (iter == metrics_map_.end())
1040 return false; 1043 return false;
1041 1044
1042 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) 1045 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second))
1043 return false; 1046 return false;
1044 1047
1045 memory_usage_map_.insert(std::make_pair(handle, *usage)); 1048 memory_usage_map_.insert(std::make_pair(handle, *usage));
1046 return true; 1049 return true;
1047 } 1050 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698