OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "headless/public/headless_browser.h" | |
6 | |
7 using Options = headless::HeadlessBrowser::Options; | |
8 using Builder = headless::HeadlessBrowser::Options::Builder; | |
9 | |
10 namespace headless { | |
11 | |
12 Options::Options(int argc, const char** argv) : argc(argc), argv(argv) {} | |
13 | |
14 Options::Options(Options&& options) | |
15 : argc(std::move(options.argc)), | |
Sami
2015/12/01 14:03:57
I think you can just do a *this = std::move(option
altimin
2015/12/01 15:17:28
Done.
| |
16 argv(std::move(options.argv)), | |
17 user_agent(std::move(options.user_agent)), | |
18 devtools_http_port(std::move(options.devtools_http_port)), | |
19 url_request_context_getter( | |
20 std::move(options.url_request_context_getter)) {} | |
21 | |
22 Options::~Options() {} | |
23 | |
24 Builder::Builder(int argc, const char** argv) : options_(argc, argv) {} | |
25 | |
26 Builder::~Builder() {} | |
27 | |
28 Builder& Builder::SetUserAgent(const std::string& user_agent) { | |
29 options_.user_agent = make_scoped_ptr(new std::string(user_agent)); | |
30 return *this; | |
31 } | |
32 | |
33 Builder& Builder::EnableDevtoolsServer(int port) { | |
34 options_.devtools_http_port = make_scoped_ptr(new int(port)); | |
35 return *this; | |
36 } | |
37 | |
38 Builder& Builder::SetURLRequestContextGetter( | |
39 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) { | |
40 options_.url_request_context_getter = url_request_context_getter; | |
41 return *this; | |
42 } | |
43 | |
44 Options Builder::Build() { | |
45 return std::move(options_); | |
Sami
2015/12/01 14:03:57
No need for std::move here -- returning already ma
altimin
2015/12/01 15:17:28
No. Returning makes only temporary variables rvalu
Sami
2015/12/01 17:47:33
Ah, right, because we shouldn't move those members
alex clarke (OOO till 29th)
2015/12/01 20:07:30
I'd argue we just don't need to care about the per
| |
46 } | |
47 | |
48 } // namespace headless | |
OLD | NEW |