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

Side by Side Diff: content/child/fileapi/file_system_dispatcher.cc

Issue 1544273002: Switch to standard integer types in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/child/fileapi/file_system_dispatcher.h" 5 #include "content/child/fileapi/file_system_dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/macros.h"
9 #include "base/process/process.h" 10 #include "base/process/process.h"
10 #include "content/child/child_thread_impl.h" 11 #include "content/child/child_thread_impl.h"
11 #include "content/common/fileapi/file_system_messages.h" 12 #include "content/common/fileapi/file_system_messages.h"
12 #include "storage/common/fileapi/file_system_info.h" 13 #include "storage/common/fileapi/file_system_info.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class FileSystemDispatcher::CallbackDispatcher { 17 class FileSystemDispatcher::CallbackDispatcher {
17 public: 18 public:
18 typedef CallbackDispatcher self; 19 typedef CallbackDispatcher self;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const GURL& root) { 105 const GURL& root) {
105 filesystem_callback_.Run(name, root); 106 filesystem_callback_.Run(name, root);
106 } 107 }
107 108
108 void DidResolveURL(const storage::FileSystemInfo& info, 109 void DidResolveURL(const storage::FileSystemInfo& info,
109 const base::FilePath& file_path, 110 const base::FilePath& file_path,
110 bool is_directory) { 111 bool is_directory) {
111 resolve_callback_.Run(info, file_path, is_directory); 112 resolve_callback_.Run(info, file_path, is_directory);
112 } 113 }
113 114
114 void DidWrite(int64 bytes, bool complete) { 115 void DidWrite(int64_t bytes, bool complete) {
115 write_callback_.Run(bytes, complete); 116 write_callback_.Run(bytes, complete);
116 } 117 }
117 118
118 private: 119 private:
119 CallbackDispatcher() {} 120 CallbackDispatcher() {}
120 121
121 StatusCallback status_callback_; 122 StatusCallback status_callback_;
122 MetadataCallback metadata_callback_; 123 MetadataCallback metadata_callback_;
123 CreateSnapshotFileCallback snapshot_callback_; 124 CreateSnapshotFileCallback snapshot_callback_;
124 ReadDirectoryCallback directory_callback_; 125 ReadDirectoryCallback directory_callback_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void FileSystemDispatcher::ReadDirectory( 262 void FileSystemDispatcher::ReadDirectory(
262 const GURL& path, 263 const GURL& path,
263 const ReadDirectoryCallback& success_callback, 264 const ReadDirectoryCallback& success_callback,
264 const StatusCallback& error_callback) { 265 const StatusCallback& error_callback) {
265 int request_id = dispatchers_.Add( 266 int request_id = dispatchers_.Add(
266 CallbackDispatcher::Create(success_callback, error_callback)); 267 CallbackDispatcher::Create(success_callback, error_callback));
267 ChildThreadImpl::current()->Send( 268 ChildThreadImpl::current()->Send(
268 new FileSystemHostMsg_ReadDirectory(request_id, path)); 269 new FileSystemHostMsg_ReadDirectory(request_id, path));
269 } 270 }
270 271
271 void FileSystemDispatcher::Truncate( 272 void FileSystemDispatcher::Truncate(const GURL& path,
272 const GURL& path, 273 int64_t offset,
273 int64 offset, 274 int* request_id_out,
274 int* request_id_out, 275 const StatusCallback& callback) {
275 const StatusCallback& callback) {
276 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); 276 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
277 ChildThreadImpl::current()->Send( 277 ChildThreadImpl::current()->Send(
278 new FileSystemHostMsg_Truncate(request_id, path, offset)); 278 new FileSystemHostMsg_Truncate(request_id, path, offset));
279 279
280 if (request_id_out) 280 if (request_id_out)
281 *request_id_out = request_id; 281 *request_id_out = request_id;
282 } 282 }
283 283
284 void FileSystemDispatcher::Write( 284 void FileSystemDispatcher::Write(const GURL& path,
285 const GURL& path, 285 const std::string& blob_id,
286 const std::string& blob_id, 286 int64_t offset,
287 int64 offset, 287 int* request_id_out,
288 int* request_id_out, 288 const WriteCallback& success_callback,
289 const WriteCallback& success_callback, 289 const StatusCallback& error_callback) {
290 const StatusCallback& error_callback) {
291 int request_id = dispatchers_.Add( 290 int request_id = dispatchers_.Add(
292 CallbackDispatcher::Create(success_callback, error_callback)); 291 CallbackDispatcher::Create(success_callback, error_callback));
293 ChildThreadImpl::current()->Send( 292 ChildThreadImpl::current()->Send(
294 new FileSystemHostMsg_Write(request_id, path, blob_id, offset)); 293 new FileSystemHostMsg_Write(request_id, path, blob_id, offset));
295 294
296 if (request_id_out) 295 if (request_id_out)
297 *request_id_out = request_id; 296 *request_id_out = request_id;
298 } 297 }
299 298
300 void FileSystemDispatcher::Cancel( 299 void FileSystemDispatcher::Cancel(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 383 }
385 384
386 void FileSystemDispatcher::OnDidFail( 385 void FileSystemDispatcher::OnDidFail(
387 int request_id, base::File::Error error_code) { 386 int request_id, base::File::Error error_code) {
388 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); 387 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
389 DCHECK(dispatcher); 388 DCHECK(dispatcher);
390 dispatcher->DidFail(error_code); 389 dispatcher->DidFail(error_code);
391 dispatchers_.Remove(request_id); 390 dispatchers_.Remove(request_id);
392 } 391 }
393 392
394 void FileSystemDispatcher::OnDidWrite( 393 void FileSystemDispatcher::OnDidWrite(int request_id,
395 int request_id, int64 bytes, bool complete) { 394 int64_t bytes,
395 bool complete) {
396 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); 396 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
397 DCHECK(dispatcher); 397 DCHECK(dispatcher);
398 dispatcher->DidWrite(bytes, complete); 398 dispatcher->DidWrite(bytes, complete);
399 if (complete) 399 if (complete)
400 dispatchers_.Remove(request_id); 400 dispatchers_.Remove(request_id);
401 } 401 }
402 402
403 } // namespace content 403 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/file_system_dispatcher.h ('k') | content/child/fileapi/webfilesystem_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698