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

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

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory_details.h" 5 #include "chrome/browser/memory_details.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 info.process_type = iter.GetData().process_type; 210 info.process_type = iter.GetData().process_type;
211 info.renderer_type = ProcessMemoryInformation::RENDERER_UNKNOWN; 211 info.renderer_type = ProcessMemoryInformation::RENDERER_UNKNOWN;
212 info.titles.push_back(iter.GetData().name); 212 info.titles.push_back(iter.GetData().name);
213 child_info.push_back(info); 213 child_info.push_back(info);
214 } 214 }
215 215
216 // Now go do expensive memory lookups in a thread pool. 216 // Now go do expensive memory lookups in a thread pool.
217 base::PostTaskWithTraits( 217 base::PostTaskWithTraits(
218 FROM_HERE, 218 FROM_HERE,
219 base::TaskTraits() 219 {base::MayBlock(), base::TaskPriority::BACKGROUND,
220 .MayBlock() 220 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
221 .WithPriority(base::TaskPriority::BACKGROUND)
222 .WithShutdownBehavior(
223 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
224 base::BindOnce(&MemoryDetails::CollectProcessData, this, child_info)); 221 base::BindOnce(&MemoryDetails::CollectProcessData, this, child_info));
225 } 222 }
226 223
227 void MemoryDetails::CollectChildInfoOnUIThread() { 224 void MemoryDetails::CollectChildInfoOnUIThread() {
228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 225 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
229 ProcessData* const chrome_browser = ChromeBrowser(); 226 ProcessData* const chrome_browser = ChromeBrowser();
230 227
231 // First pass, collate the widgets by process ID. 228 // First pass, collate the widgets by process ID.
232 std::map<base::ProcessId, std::vector<RenderWidgetHost*>> widgets_by_pid; 229 std::map<base::ProcessId, std::vector<RenderWidgetHost*>> widgets_by_pid;
233 std::unique_ptr<content::RenderWidgetHostIterator> widget_it( 230 std::unique_ptr<content::RenderWidgetHostIterator> widget_it(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // Get rid of other Chrome processes that are from a different profile. 355 // Get rid of other Chrome processes that are from a different profile.
359 auto is_unknown = [](ProcessMemoryInformation& process) { 356 auto is_unknown = [](ProcessMemoryInformation& process) {
360 return process.process_type == content::PROCESS_TYPE_UNKNOWN; 357 return process.process_type == content::PROCESS_TYPE_UNKNOWN;
361 }; 358 };
362 auto& vector = chrome_browser->processes; 359 auto& vector = chrome_browser->processes;
363 vector.erase(std::remove_if(vector.begin(), vector.end(), is_unknown), 360 vector.erase(std::remove_if(vector.begin(), vector.end(), is_unknown),
364 vector.end()); 361 vector.end());
365 362
366 OnDetailsAvailable(); 363 OnDetailsAvailable();
367 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698