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

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

Issue 2856091: Fix some problems with TaskManagerBrowserTest.PopulateWebCacheFields: (Closed)
Patch Set: memset Created 10 years, 4 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
« no previous file with comments | « chrome/browser/task_manager_resource_providers.h ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_resource_providers.h" 5 #include "chrome/browser/task_manager_resource_providers.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #endif // defined(OS_WIN) 47 #endif // defined(OS_WIN)
48 48
49 //////////////////////////////////////////////////////////////////////////////// 49 ////////////////////////////////////////////////////////////////////////////////
50 // TaskManagerTabContentsResource class 50 // TaskManagerTabContentsResource class
51 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
52 52
53 TaskManagerTabContentsResource::TaskManagerTabContentsResource( 53 TaskManagerTabContentsResource::TaskManagerTabContentsResource(
54 TabContents* tab_contents) 54 TabContents* tab_contents)
55 : tab_contents_(tab_contents), 55 : tab_contents_(tab_contents),
56 pending_stats_update_(false), 56 pending_stats_update_(false),
57 had_stats_update_(false),
57 v8_memory_allocated_(0), 58 v8_memory_allocated_(0),
58 v8_memory_used_(0), 59 v8_memory_used_(0),
59 pending_v8_memory_allocated_update_(false) { 60 pending_v8_memory_allocated_update_(false) {
60 // We cache the process as when the TabContents is closed the process 61 // We cache the process as when the TabContents is closed the process
61 // becomes NULL and the TaskManager still needs it. 62 // becomes NULL and the TaskManager still needs it.
62 process_ = tab_contents_->GetRenderProcessHost()->GetHandle(); 63 process_ = tab_contents_->GetRenderProcessHost()->GetHandle();
63 pid_ = base::GetProcId(process_); 64 pid_ = base::GetProcId(process_);
64 stats_.images.size = 0; 65 memset(&stats_, 0, sizeof(stats_));
65 stats_.cssStyleSheets.size = 0;
66 stats_.scripts.size = 0;
67 stats_.xslStyleSheets.size = 0;
68 stats_.fonts.size = 0;
69 } 66 }
70 67
71 TaskManagerTabContentsResource::~TaskManagerTabContentsResource() { 68 TaskManagerTabContentsResource::~TaskManagerTabContentsResource() {
72 } 69 }
73 70
74 std::wstring TaskManagerTabContentsResource::GetTitle() const { 71 std::wstring TaskManagerTabContentsResource::GetTitle() const {
75 // Fall back on the URL if there's no title. 72 // Fall back on the URL if there's no title.
76 std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle())); 73 std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle()));
77 if (tab_title.empty()) { 74 if (tab_title.empty()) {
78 tab_title = UTF8ToWide(tab_contents_->GetURL().spec()); 75 tab_title = UTF8ToWide(tab_contents_->GetURL().spec());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 112 }
116 113
117 size_t TaskManagerTabContentsResource::GetV8MemoryUsed() const { 114 size_t TaskManagerTabContentsResource::GetV8MemoryUsed() const {
118 return v8_memory_used_; 115 return v8_memory_used_;
119 } 116 }
120 117
121 void TaskManagerTabContentsResource::NotifyResourceTypeStats( 118 void TaskManagerTabContentsResource::NotifyResourceTypeStats(
122 const WebKit::WebCache::ResourceTypeStats& stats) { 119 const WebKit::WebCache::ResourceTypeStats& stats) {
123 stats_ = stats; 120 stats_ = stats;
124 pending_stats_update_ = false; 121 pending_stats_update_ = false;
122 had_stats_update_ = true;
125 } 123 }
126 124
127 void TaskManagerTabContentsResource::NotifyV8HeapStats( 125 void TaskManagerTabContentsResource::NotifyV8HeapStats(
128 size_t v8_memory_allocated, size_t v8_memory_used) { 126 size_t v8_memory_allocated, size_t v8_memory_used) {
129 v8_memory_allocated_ = v8_memory_allocated; 127 v8_memory_allocated_ = v8_memory_allocated;
130 v8_memory_used_ = v8_memory_used; 128 v8_memory_used_ = v8_memory_used;
131 pending_v8_memory_allocated_update_ = false; 129 pending_v8_memory_allocated_update_ = false;
132 } 130 }
133 131
134 SkBitmap TaskManagerTabContentsResource::GetIcon() const { 132 SkBitmap TaskManagerTabContentsResource::GetIcon() const {
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 903
906 return &resource_; 904 return &resource_;
907 } 905 }
908 906
909 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { 907 void TaskManagerBrowserProcessResourceProvider::StartUpdating() {
910 task_manager_->AddResource(&resource_); 908 task_manager_->AddResource(&resource_);
911 } 909 }
912 910
913 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { 911 void TaskManagerBrowserProcessResourceProvider::StopUpdating() {
914 } 912 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager_resource_providers.h ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698