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

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry.cc

Issue 2896473002: Remove FILE thread dependency in protocol_handler_registry_unittest.cc (Closed)
Patch Set: MakeShared to MakeRefCounted 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/custom_handlers/protocol_handler_registry.cc
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index bc28906f58893addbf3a85ac83a5374254963379..8bde36a1273b6ddea473bb0d1880454ac006c199 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile_io_data.h"
@@ -247,19 +248,13 @@ bool ProtocolHandlerRegistry::Delegate::IsExternalHandlerRegistered(
return ProfileIOData::IsHandledProtocol(protocol);
}
-scoped_refptr<shell_integration::DefaultProtocolClientWorker>
-ProtocolHandlerRegistry::Delegate::CreateShellWorker(
- const shell_integration::DefaultWebClientWorkerCallback& callback,
- const std::string& protocol) {
- return new shell_integration::DefaultProtocolClientWorker(callback, protocol);
-}
-
void ProtocolHandlerRegistry::Delegate::RegisterWithOSAsDefaultClient(
const std::string& protocol, ProtocolHandlerRegistry* registry) {
// The worker pointer is reference counted. While it is running, the
- // message loops of the FILE and UI thread will hold references to it
- // and it will be automatically freed once all its tasks have finished.
- CreateShellWorker(registry->GetDefaultWebClientCallback(protocol), protocol)
+ // sequence it runs on will hold references it will be automatically freed
+ // once all its tasks have finished.
+ base::MakeRefCounted<shell_integration::DefaultProtocolClientWorker>(
+ registry->GetDefaultWebClientCallback(protocol), protocol)
->StartSetAsDefault();
}
@@ -414,13 +409,7 @@ void ProtocolHandlerRegistry::InitProtocolSettings() {
for (ProtocolHandlerMap::const_iterator p = default_handlers_.begin();
p != default_handlers_.end(); ++p) {
ProtocolHandler handler = p->second;
- // The worker pointer is reference counted. While it is running the
- // message loops of the FILE and UI thread will hold references to it
- // and it will be automatically freed once all its tasks have finished.
- delegate_
- ->CreateShellWorker(GetDefaultWebClientCallback(handler.protocol()),
- handler.protocol())
- ->StartSetAsDefault();
+ delegate_->RegisterWithOSAsDefaultClient(handler.protocol(), this);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698