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

Side by Side Diff: extensions/common/extension_builder.cc

Issue 1511103003: Use rvalue reference instead of ExtensionBuilder::pass() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "extensions/common/extension_builder.h" 5 #include "extensions/common/extension_builder.h"
6 6
7 #include "extensions/common/extension.h" 7 #include "extensions/common/extension.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 ExtensionBuilder::ExtensionBuilder() 11 ExtensionBuilder::ExtensionBuilder()
12 : location_(Manifest::UNPACKED), 12 : location_(Manifest::UNPACKED),
13 flags_(Extension::NO_FLAGS) { 13 flags_(Extension::NO_FLAGS) {
14 } 14 }
15 ExtensionBuilder::~ExtensionBuilder() {} 15 ExtensionBuilder::~ExtensionBuilder() {}
16 16
17 ExtensionBuilder::ExtensionBuilder(ExtensionBuilder&& other)
18 : path_(other.path_),
danakj 2015/12/09 18:46:44 move the string instead of copying it?
limasdf 2015/12/16 09:34:54 Done.
19 location_(other.location_),
20 manifest_(other.manifest_.release()),
danakj 2015/12/09 18:46:44 why isn't this manifest_(std::move(other.manifest_
limasdf 2015/12/16 09:34:54 Done.
21 flags_(other.flags_),
22 id_(other.id_) {}
danakj 2015/12/09 18:46:44 move the string dont copy?
limasdf 2015/12/16 09:34:54 Done.
23
17 scoped_refptr<Extension> ExtensionBuilder::Build() { 24 scoped_refptr<Extension> ExtensionBuilder::Build() {
18 std::string error; 25 std::string error;
19 scoped_refptr<Extension> extension = Extension::Create( 26 scoped_refptr<Extension> extension = Extension::Create(
20 path_, 27 path_,
21 location_, 28 location_,
22 *manifest_, 29 *manifest_,
23 flags_, 30 flags_,
24 id_, 31 id_,
25 &error); 32 &error);
26 CHECK_EQ("", error); 33 CHECK_EQ("", error);
(...skipping 25 matching lines...) Expand all
52 flags_ |= init_from_value_flags; 59 flags_ |= init_from_value_flags;
53 return *this; 60 return *this;
54 } 61 }
55 62
56 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) { 63 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) {
57 id_ = id; 64 id_ = id;
58 return *this; 65 return *this;
59 } 66 }
60 67
61 } // namespace extensions 68 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698