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

Side by Side Diff: mojo/fetcher/update_fetcher.cc

Issue 1538823002: Convert Pass()→std::move() in mojo/ (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
« no previous file with comments | « mojo/fetcher/network_fetcher_unittest.cc ('k') | mojo/gles2/command_buffer_client_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "mojo/fetcher/update_fetcher.h" 5 #include "mojo/fetcher/update_fetcher.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
9 #include "base/format_macros.h" 11 #include "base/format_macros.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
12 #include "mojo/common/common_type_converters.h" 14 #include "mojo/common/common_type_converters.h"
13 #include "mojo/common/data_pipe_utils.h" 15 #include "mojo/common/data_pipe_utils.h"
14 #include "mojo/common/url_type_converters.h" 16 #include "mojo/common/url_type_converters.h"
15 17
16 namespace mojo { 18 namespace mojo {
(...skipping 26 matching lines...) Expand all
43 } 45 }
44 46
45 GURL UpdateFetcher::GetRedirectReferer() const { 47 GURL UpdateFetcher::GetRedirectReferer() const {
46 return GURL::EmptyGURL(); 48 return GURL::EmptyGURL();
47 } 49 }
48 URLResponsePtr UpdateFetcher::AsURLResponse(base::TaskRunner* task_runner, 50 URLResponsePtr UpdateFetcher::AsURLResponse(base::TaskRunner* task_runner,
49 uint32_t skip) { 51 uint32_t skip) {
50 URLResponsePtr response(URLResponse::New()); 52 URLResponsePtr response(URLResponse::New());
51 response->url = String::From(url_); 53 response->url = String::From(url_);
52 DataPipe data_pipe; 54 DataPipe data_pipe;
53 response->body = data_pipe.consumer_handle.Pass(); 55 response->body = std::move(data_pipe.consumer_handle);
54 int64 file_size; 56 int64 file_size;
55 if (base::GetFileSize(path_, &file_size)) { 57 if (base::GetFileSize(path_, &file_size)) {
56 response->headers = Array<HttpHeaderPtr>(1); 58 response->headers = Array<HttpHeaderPtr>(1);
57 HttpHeaderPtr header = HttpHeader::New(); 59 HttpHeaderPtr header = HttpHeader::New();
58 header->name = "Content-Length"; 60 header->name = "Content-Length";
59 header->value = base::StringPrintf("%" PRId64, file_size); 61 header->value = base::StringPrintf("%" PRId64, file_size);
60 response->headers[0] = header.Pass(); 62 response->headers[0] = std::move(header);
61 } 63 }
62 common::CopyFromFile(path_, data_pipe.producer_handle.Pass(), skip, 64 common::CopyFromFile(path_, std::move(data_pipe.producer_handle), skip,
63 task_runner, base::Bind(&IgnoreResult)); 65 task_runner, base::Bind(&IgnoreResult));
64 return response.Pass(); 66 return response;
65 } 67 }
66 68
67 void UpdateFetcher::AsPath( 69 void UpdateFetcher::AsPath(
68 base::TaskRunner* task_runner, 70 base::TaskRunner* task_runner,
69 base::Callback<void(const base::FilePath&, bool)> callback) { 71 base::Callback<void(const base::FilePath&, bool)> callback) {
70 base::MessageLoop::current()->PostTask( 72 base::MessageLoop::current()->PostTask(
71 FROM_HERE, base::Bind(callback, path_, base::PathExists(path_))); 73 FROM_HERE, base::Bind(callback, path_, base::PathExists(path_)));
72 } 74 }
73 75
74 std::string UpdateFetcher::MimeType() { 76 std::string UpdateFetcher::MimeType() {
(...skipping 16 matching lines...) Expand all
91 return true; 93 return true;
92 } 94 }
93 95
94 void UpdateFetcher::OnGetAppPath(const mojo::String& path) { 96 void UpdateFetcher::OnGetAppPath(const mojo::String& path) {
95 path_ = base::FilePath::FromUTF8Unsafe(path); 97 path_ = base::FilePath::FromUTF8Unsafe(path);
96 loader_callback_.Run(make_scoped_ptr(this)); 98 loader_callback_.Run(make_scoped_ptr(this));
97 } 99 }
98 100
99 } // namespace fetcher 101 } // namespace fetcher
100 } // namespace mojo 102 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/fetcher/network_fetcher_unittest.cc ('k') | mojo/gles2/command_buffer_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698