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

Side by Side Diff: chrome/browser/ui/webui/conflicts_ui.cc

Issue 2420133002: Make module enumeration a low priority background task. (Closed)
Patch Set: Fix small bug. Created 4 years, 2 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 | « no previous file | chrome/browser/win/enumerate_modules_model.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) 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/ui/webui/conflicts_ui.h" 5 #include "chrome/browser/ui/webui/conflicts_ui.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 void ConflictsDOMHandler::HandleRequestModuleList(const base::ListValue* args) { 116 void ConflictsDOMHandler::HandleRequestModuleList(const base::ListValue* args) {
117 // The request is handled asynchronously, and will callback via 117 // The request is handled asynchronously, and will callback via
118 // OnScanCompleted on completion. 118 // OnScanCompleted on completion.
119 auto* model = EnumerateModulesModel::GetInstance(); 119 auto* model = EnumerateModulesModel::GetInstance();
120 120
121 // The JS shouldn't be abusive and call 'requestModuleList' twice, but it's 121 // The JS shouldn't be abusive and call 'requestModuleList' twice, but it's
122 // easy enough to defend against this. 122 // easy enough to defend against this.
123 if (!observer_.IsObserving(model)) { 123 if (!observer_.IsObserving(model)) {
124 observer_.Add(model); 124 observer_.Add(model);
125 model->ScanNow(); 125
126 // Ask the scan to be performed immediately, and not in background mode.
127 // This ensures the results are available ASAP for the UI.
128 model->ScanNow(false);
126 } 129 }
127 } 130 }
128 131
129 void ConflictsDOMHandler::SendModuleList() { 132 void ConflictsDOMHandler::SendModuleList() {
130 auto* loaded_modules = EnumerateModulesModel::GetInstance(); 133 auto* loaded_modules = EnumerateModulesModel::GetInstance();
131 base::ListValue* list = loaded_modules->GetModuleList(); 134 base::ListValue* list = loaded_modules->GetModuleList();
132 base::DictionaryValue results; 135 base::DictionaryValue results;
133 results.Set("moduleList", list); 136 results.Set("moduleList", list);
134 137
135 // Add the section title and the total count for bad modules found. 138 // Add the section title and the total count for bad modules found.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 179
177 // static 180 // static
178 base::RefCountedMemory* ConflictsUI::GetFaviconResourceBytes( 181 base::RefCountedMemory* ConflictsUI::GetFaviconResourceBytes(
179 ui::ScaleFactor scale_factor) { 182 ui::ScaleFactor scale_factor) {
180 return static_cast<base::RefCountedMemory*>( 183 return static_cast<base::RefCountedMemory*>(
181 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 184 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
182 IDR_CONFLICT_FAVICON, scale_factor)); 185 IDR_CONFLICT_FAVICON, scale_factor));
183 } 186 }
184 187
185 #endif 188 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/win/enumerate_modules_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698