Commit 048019f3 authored by dcheng's avatar dcheng Committed by Commit bot

Simplify ScopedVector<scoped_ptr<T>> to ScopedVector<T>.

Also removes a couple more PassAs() calls.

BUG=423621

Review URL: https://codereview.chromium.org/654263004

Cr-Commit-Position: refs/heads/master@{#300129}
parent 923ac874
......@@ -92,8 +92,7 @@ Value RunGetTargetOutputs(Scope* scope,
*err = Err(function, "No targets defined in this context.");
return Value();
}
for (const auto& cur : *collector) {
const Item* item = cur->get();
for (const auto& item : *collector) {
if (item->label() != label)
continue;
......
......@@ -65,7 +65,7 @@ TEST_F(GetTargetOutputsTest, Copy) {
action->action_values().outputs() =
SubstitutionList::MakeForTest("//out/Debug/{{source_file_part}}.one");
items_.push_back(new scoped_ptr<Item>(action));
items_.push_back(action);
Err err;
Value result = GetTargetOutputs("//foo:bar", &err);
......@@ -80,7 +80,7 @@ TEST_F(GetTargetOutputsTest, Action) {
"//output1.txt",
"//output2.txt");
items_.push_back(new scoped_ptr<Item>(action));
items_.push_back(action);
Err err;
Value result = GetTargetOutputs("//foo:bar", &err);
......@@ -96,7 +96,7 @@ TEST_F(GetTargetOutputsTest, ActionForeach) {
"//out/Debug/{{source_file_part}}.one",
"//out/Debug/{{source_file_part}}.two");
items_.push_back(new scoped_ptr<Item>(action));
items_.push_back(action);
Err err;
Value result = GetTargetOutputs("//foo:bar", &err);
......
......@@ -342,7 +342,7 @@ Value RunToolchain(Scope* scope,
*err = Err(function, "Can't define a toolchain in this context.");
return Value();
}
collector->push_back(new scoped_ptr<Item>(toolchain.PassAs<Item>()));
collector->push_back(toolchain.release());
return Value();
}
......
......@@ -251,7 +251,7 @@ Value RunConfig(const FunctionCallNode* function,
*err = Err(function, "Can't define a config in this context.");
return Value();
}
collector->push_back(new scoped_ptr<Item>(config.PassAs<Item>()));
collector->push_back(config.release());
return Value();
}
......
......@@ -265,8 +265,10 @@ void LoaderImpl::BackgroundLoadFile(const Settings* settings,
g_scheduler->FailWithError(err);
// Pass all of the items that were defined off to the builder.
for (const auto& item : collected_items)
settings->build_settings()->ItemDefined(item->Pass());
for (auto& item : collected_items) {
settings->build_settings()->ItemDefined(make_scoped_ptr(item));
item = nullptr;
}
trace.Done();
......
......@@ -40,9 +40,8 @@ class Template;
class Scope {
public:
typedef base::hash_map<base::StringPiece, Value> KeyValueMap;
// Holds an owning list of scoped_ptrs of Items (since we can't make a vector
// of scoped_ptrs).
typedef ScopedVector< scoped_ptr<Item> > ItemVector;
// Holds an owning list of Items.
typedef ScopedVector<Item> ItemVector;
// Allows code to provide values for built-in variables. This class will
// automatically register itself on construction and deregister itself on
......
......@@ -126,7 +126,7 @@ void TargetGenerator::GenerateTarget(Scope* scope,
*err = Err(function_call, "Can't define a target in this context.");
return;
}
collector->push_back(new scoped_ptr<Item>(target.PassAs<Item>()));
collector->push_back(target.release());
}
const BuildSettings* TargetGenerator::GetBuildSettings() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment