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

Unified Diff: chrome/browser/extensions/user_script_master.cc

Issue 345023: Get rid of MessageLoop* caching in extensions code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/user_script_master.cc
===================================================================
--- chrome/browser/extensions/user_script_master.cc (revision 30521)
+++ chrome/browser/extensions/user_script_master.cc (working copy)
@@ -36,8 +36,8 @@
}
UserScriptMaster::ScriptReloader::ScriptReloader(UserScriptMaster* master)
- : master_(master),
- master_message_loop_(MessageLoop::current()) {
+ : master_(master) {
+ CHECK(ChromeThread::GetCurrentThreadIdentifier(&master_thread_id_));
}
// static
@@ -110,15 +110,15 @@
}
void UserScriptMaster::ScriptReloader::StartScan(
- MessageLoop* work_loop, const FilePath& script_dir,
- const UserScriptList& lone_scripts) {
+ const FilePath& script_dir, const UserScriptList& lone_scripts) {
// Add a reference to ourselves to keep ourselves alive while we're running.
// Balanced by NotifyMaster().
AddRef();
- work_loop->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &UserScriptMaster::ScriptReloader::RunScan,
- script_dir, lone_scripts));
+ ChromeThread::PostTask(
+ ChromeThread::FILE, FROM_HERE,
+ NewRunnableMethod(
+ this, &UserScriptMaster::ScriptReloader::RunScan, script_dir,
+ lone_scripts));
}
void UserScriptMaster::ScriptReloader::NotifyMaster(
@@ -252,17 +252,15 @@
// Scripts now contains list of up-to-date scripts. Load the content in the
// shared memory and let the master know it's ready. We need to post the task
// back even if no scripts ware found to balance the AddRef/Release calls
- master_message_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &ScriptReloader::NotifyMaster,
- Serialize(scripts)));
+ ChromeThread::PostTask(
+ master_thread_id_, FROM_HERE,
+ NewRunnableMethod(
+ this, &ScriptReloader::NotifyMaster, Serialize(scripts)));
}
-UserScriptMaster::UserScriptMaster(MessageLoop* worker_loop,
- const FilePath& script_dir)
+UserScriptMaster::UserScriptMaster(const FilePath& script_dir)
: user_script_dir_(script_dir),
- worker_loop_(worker_loop),
extensions_service_ready_(false),
pending_scan_(false) {
if (!user_script_dir_.value().empty())
@@ -383,5 +381,5 @@
if (!script_reloader_)
script_reloader_ = new ScriptReloader(this);
- script_reloader_->StartScan(worker_loop_, user_script_dir_, lone_scripts_);
+ script_reloader_->StartScan(user_script_dir_, lone_scripts_);
}
« no previous file with comments | « chrome/browser/extensions/user_script_master.h ('k') | chrome/browser/extensions/user_script_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698