OLD | NEW |
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" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/background_contents_service.h" | 15 #include "chrome/browser/background_contents_service.h" |
16 #include "chrome/browser/background_contents_service_factory.h" | 16 #include "chrome/browser/background_contents_service_factory.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/extensions/extension_host.h" | 18 #include "chrome/browser/extensions/extension_host.h" |
19 #include "chrome/browser/extensions/extension_process_manager.h" | 19 #include "chrome/browser/extensions/extension_process_manager.h" |
20 #include "chrome/browser/net/url_request_tracking.h" | |
21 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/browser/task_manager/task_manager_resource_providers.h" | 22 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
24 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
25 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
29 #include "content/browser/browser_thread.h" | 28 #include "content/browser/browser_thread.h" |
30 #include "content/browser/renderer_host/render_process_host.h" | 29 #include "content/browser/renderer_host/render_process_host.h" |
31 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 30 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 31 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
32 #include "content/browser/tab_contents/tab_contents.h" | 32 #include "content/browser/tab_contents/tab_contents.h" |
33 #include "content/common/result_codes.h" | 33 #include "content/common/result_codes.h" |
34 #include "grit/app_resources.h" | 34 #include "grit/app_resources.h" |
35 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
37 #include "net/url_request/url_request.h" | 37 #include "net/url_request/url_request.h" |
38 #include "net/url_request/url_request_job.h" | 38 #include "net/url_request/url_request_job.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
41 #include "unicode/coll.h" | 41 #include "unicode/coll.h" |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 // the render process child and routing ids - the jobs may still match a | 862 // the render process child and routing ids - the jobs may still match a |
863 // resource based on their origin id, otherwise BytesRead() will attribute | 863 // resource based on their origin id, otherwise BytesRead() will attribute |
864 // the activity to the Browser resource. | 864 // the activity to the Browser resource. |
865 int render_process_host_child_id = -1, routing_id = -1; | 865 int render_process_host_child_id = -1, routing_id = -1; |
866 ResourceDispatcherHost::RenderViewForRequest(job->request(), | 866 ResourceDispatcherHost::RenderViewForRequest(job->request(), |
867 &render_process_host_child_id, | 867 &render_process_host_child_id, |
868 &routing_id); | 868 &routing_id); |
869 | 869 |
870 // Get the origin PID of the request's originator. This will only be set for | 870 // Get the origin PID of the request's originator. This will only be set for |
871 // plugins - for renderer or browser initiated requests it will be zero. | 871 // plugins - for renderer or browser initiated requests it will be zero. |
872 int origin_pid = | 872 int origin_pid = 0; |
873 chrome_browser_net::GetOriginPIDForRequest(job->request()); | 873 ResourceDispatcherHostRequestInfo* info = |
| 874 ResourceDispatcherHost::InfoForRequest(job->request()); |
| 875 if (info) |
| 876 origin_pid = info->origin_pid(); |
874 | 877 |
875 // This happens in the IO thread, post it to the UI thread. | 878 // This happens in the IO thread, post it to the UI thread. |
876 BrowserThread::PostTask( | 879 BrowserThread::PostTask( |
877 BrowserThread::UI, FROM_HERE, | 880 BrowserThread::UI, FROM_HERE, |
878 NewRunnableMethod( | 881 NewRunnableMethod( |
879 this, | 882 this, |
880 &TaskManagerModel::BytesRead, | 883 &TaskManagerModel::BytesRead, |
881 BytesReadParam(origin_pid, | 884 BytesReadParam(origin_pid, |
882 render_process_host_child_id, | 885 render_process_host_child_id, |
883 routing_id, byte_count))); | 886 routing_id, byte_count))); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 // Count the number of extensions with background pages (including | 1048 // Count the number of extensions with background pages (including |
1046 // incognito). | 1049 // incognito). |
1047 count += CountExtensionBackgroundPagesForProfile(profile); | 1050 count += CountExtensionBackgroundPagesForProfile(profile); |
1048 if (profile->HasOffTheRecordProfile()) { | 1051 if (profile->HasOffTheRecordProfile()) { |
1049 count += CountExtensionBackgroundPagesForProfile( | 1052 count += CountExtensionBackgroundPagesForProfile( |
1050 profile->GetOffTheRecordProfile()); | 1053 profile->GetOffTheRecordProfile()); |
1051 } | 1054 } |
1052 } | 1055 } |
1053 return count; | 1056 return count; |
1054 } | 1057 } |
OLD | NEW |