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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 2301713002: Remove some UI->FILE->UI thread hops in ExecuteCodeFunction (Closed)
Patch Set: fix chromeos Created 4 years, 3 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Finally, call this method once to fetch all of the resources and 178 // Finally, call this method once to fetch all of the resources and
179 // load them. This method will delete this object when done. 179 // load them. This method will delete this object when done.
180 void Run() { 180 void Run() {
181 if (resources_.empty()) { 181 if (resources_.empty()) {
182 delete this; 182 delete this;
183 return; 183 return;
184 } 184 }
185 185
186 extensions::ExtensionResource resource = resources_.front(); 186 extensions::ExtensionResource resource = resources_.front();
187 resources_.pop(); 187 resources_.pop();
188 scoped_refptr<FileReader> reader(new FileReader(resource, base::Bind( 188 scoped_refptr<FileReader> reader(new FileReader(
189 &ContentScriptLoader::OnFileLoaded, base::Unretained(this)))); 189 resource,
190 FileReader::OptionalFileThreadTaskCallback(), // null callback.
191 base::Bind(&ContentScriptLoader::OnFileLoaded,
192 base::Unretained(this))));
190 reader->Start(); 193 reader->Start();
191 } 194 }
192 195
193 private: 196 private:
194 void OnFileLoaded(bool success, std::unique_ptr<std::string> data) { 197 void OnFileLoaded(bool success, std::unique_ptr<std::string> data) {
195 if (success) { 198 if (success) {
196 RenderViewHost* render_view_host = 199 RenderViewHost* render_view_host =
197 RenderViewHost::FromID(render_process_id_, render_view_id_); 200 RenderViewHost::FromID(render_process_id_, render_view_id_);
198 if (render_view_host) 201 if (render_view_host)
199 ExecuteScriptHelper(render_view_host, *data, extension_id_); 202 ExecuteScriptHelper(render_view_host, *data, extension_id_);
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 content::BrowserContext* context) { 1546 content::BrowserContext* context) {
1544 keyboard_listener_extension_id_ = id; 1547 keyboard_listener_extension_id_ = id;
1545 1548
1546 extensions::ExtensionRegistry* registry = 1549 extensions::ExtensionRegistry* registry =
1547 extensions::ExtensionRegistry::Get(context); 1550 extensions::ExtensionRegistry::Get(context);
1548 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1551 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1549 extension_registry_observer_.Add(registry); 1552 extension_registry_observer_.Add(registry);
1550 } 1553 }
1551 1554
1552 } // namespace chromeos 1555 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/execute_code_function.h » ('j') | extensions/browser/api/execute_code_function.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698