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

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

Issue 1543603002: Switch to standard integer types in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « mojo/fetcher/local_fetcher.h ('k') | mojo/fetcher/network_fetcher.h » ('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/local_fetcher.h" 5 #include "mojo/fetcher/local_fetcher.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <utility> 10 #include <utility>
8 11
9 #include "base/bind.h" 12 #include "base/bind.h"
10 #include "base/command_line.h" 13 #include "base/command_line.h"
11 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
12 #include "base/format_macros.h" 15 #include "base/format_macros.h"
13 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
14 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
16 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 GURL LocalFetcher::GetRedirectReferer() const { 100 GURL LocalFetcher::GetRedirectReferer() const {
98 return GURL::EmptyGURL(); 101 return GURL::EmptyGURL();
99 } 102 }
100 103
101 URLResponsePtr LocalFetcher::AsURLResponse(base::TaskRunner* task_runner, 104 URLResponsePtr LocalFetcher::AsURLResponse(base::TaskRunner* task_runner,
102 uint32_t skip) { 105 uint32_t skip) {
103 URLResponsePtr response(URLResponse::New()); 106 URLResponsePtr response(URLResponse::New());
104 response->url = String::From(url_); 107 response->url = String::From(url_);
105 DataPipe data_pipe; 108 DataPipe data_pipe;
106 response->body = std::move(data_pipe.consumer_handle); 109 response->body = std::move(data_pipe.consumer_handle);
107 int64 file_size; 110 int64_t file_size;
108 if (base::GetFileSize(path_, &file_size)) { 111 if (base::GetFileSize(path_, &file_size)) {
109 response->headers = Array<HttpHeaderPtr>(1); 112 response->headers = Array<HttpHeaderPtr>(1);
110 HttpHeaderPtr header = HttpHeader::New(); 113 HttpHeaderPtr header = HttpHeader::New();
111 header->name = "Content-Length"; 114 header->name = "Content-Length";
112 header->value = base::StringPrintf("%" PRId64, file_size); 115 header->value = base::StringPrintf("%" PRId64, file_size);
113 response->headers[0] = std::move(header); 116 response->headers[0] = std::move(header);
114 } 117 }
115 response->mime_type = String::From(MimeType()); 118 response->mime_type = String::From(MimeType());
116 common::CopyFromFile(path_, std::move(data_pipe.producer_handle), skip, 119 common::CopyFromFile(path_, std::move(data_pipe.producer_handle), skip,
117 task_runner, base::Bind(&IgnoreResult)); 120 task_runner, base::Bind(&IgnoreResult));
(...skipping 23 matching lines...) Expand all
141 ReadFileToString(path_, &start_of_file, kMaxShebangLength); 144 ReadFileToString(path_, &start_of_file, kMaxShebangLength);
142 size_t return_position = start_of_file.find('\n'); 145 size_t return_position = start_of_file.find('\n');
143 if (return_position == std::string::npos) 146 if (return_position == std::string::npos)
144 return false; 147 return false;
145 *line = start_of_file.substr(0, return_position + 1); 148 *line = start_of_file.substr(0, return_position + 1);
146 return true; 149 return true;
147 } 150 }
148 151
149 } // namespace fetcher 152 } // namespace fetcher
150 } // namespace mojo 153 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/fetcher/local_fetcher.h ('k') | mojo/fetcher/network_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698