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

Unified Diff: gin/modules/module_registry.cc

Issue 1848423002: Convert //gin to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « gin/modules/module_registry.h ('k') | gin/modules/module_registry_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/modules/module_registry.cc
diff --git a/gin/modules/module_registry.cc b/gin/modules/module_registry.cc
index deec1874b485242828fce9b09a058ad13c543be3..209eb06591dac4f8f433f04edfee9d65bffeb0fb 100644
--- a/gin/modules/module_registry.cc
+++ b/gin/modules/module_registry.cc
@@ -56,7 +56,7 @@ namespace {
const char kModuleRegistryKey[] = "ModuleRegistry";
struct ModuleRegistryData : public base::SupportsUserData::Data {
- scoped_ptr<ModuleRegistry> registry;
+ std::unique_ptr<ModuleRegistry> registry;
};
void Define(const v8::FunctionCallbackInfo<Value>& info) {
@@ -76,7 +76,7 @@ void Define(const v8::FunctionCallbackInfo<Value>& info) {
if (!args.GetNext(&factory))
return args.ThrowError();
- scoped_ptr<PendingModule> pending(new PendingModule);
+ std::unique_ptr<PendingModule> pending(new PendingModule);
pending->id = id;
pending->dependencies = dependencies;
pending->factory.Reset(args.isolate(), factory);
@@ -158,7 +158,7 @@ void ModuleRegistry::AddBuiltinModule(Isolate* isolate, const std::string& id,
}
void ModuleRegistry::AddPendingModule(Isolate* isolate,
- scoped_ptr<PendingModule> pending) {
+ std::unique_ptr<PendingModule> pending) {
const std::string pending_id = pending->id;
const std::vector<std::string> pending_dependencies = pending->dependencies;
AttemptToLoad(isolate, std::move(pending));
@@ -227,7 +227,8 @@ bool ModuleRegistry::CheckDependencies(PendingModule* pending) {
return num_missing_dependencies == 0;
}
-bool ModuleRegistry::Load(Isolate* isolate, scoped_ptr<PendingModule> pending) {
+bool ModuleRegistry::Load(Isolate* isolate,
+ std::unique_ptr<PendingModule> pending) {
if (!pending->id.empty() && available_modules_.count(pending->id))
return true; // We've already loaded this module.
@@ -253,7 +254,7 @@ bool ModuleRegistry::Load(Isolate* isolate, scoped_ptr<PendingModule> pending) {
}
bool ModuleRegistry::AttemptToLoad(Isolate* isolate,
- scoped_ptr<PendingModule> pending) {
+ std::unique_ptr<PendingModule> pending) {
if (!CheckDependencies(pending.get())) {
pending_modules_.push_back(pending.release());
return false;
@@ -276,7 +277,7 @@ void ModuleRegistry::AttemptToLoadMoreModules(Isolate* isolate) {
PendingModuleVector pending_modules;
pending_modules.swap(pending_modules_);
for (size_t i = 0; i < pending_modules.size(); ++i) {
- scoped_ptr<PendingModule> pending(pending_modules[i]);
+ std::unique_ptr<PendingModule> pending(pending_modules[i]);
pending_modules[i] = NULL;
if (AttemptToLoad(isolate, std::move(pending)))
keep_trying = true;
« no previous file with comments | « gin/modules/module_registry.h ('k') | gin/modules/module_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698