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

Side by Side Diff: net/base/file_stream_context.cc

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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 "net/base/file_stream_context.h" 5 #include "net/base/file_stream_context.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
11 #include "base/task_runner.h" 11 #include "base/task_runner.h"
12 #include "base/task_runner_util.h" 12 #include "base/task_runner_util.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 16
17 #if defined(OS_ANDROID) 17 #if defined(OS_ANDROID)
18 #include "base/android/content_uri_utils.h" 18 #include "base/android/content_uri_utils.h"
19 #endif 19 #endif
20 20
21 namespace net { 21 namespace net {
22 22
23 namespace { 23 namespace {
24 24
25 void CallInt64ToInt(const CompletionCallback& callback, int64 result) { 25 void CallInt64ToInt(const CompletionCallback& callback, int64_t result) {
26 callback.Run(static_cast<int>(result)); 26 callback.Run(static_cast<int>(result));
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 FileStream::Context::IOResult::IOResult() 31 FileStream::Context::IOResult::IOResult()
32 : result(OK), 32 : result(OK),
33 os_error(0) { 33 os_error(0) {
34 } 34 }
35 35
36 FileStream::Context::IOResult::IOResult(int64 result, 36 FileStream::Context::IOResult::IOResult(int64_t result,
37 logging::SystemErrorCode os_error) 37 logging::SystemErrorCode os_error)
38 : result(result), 38 : result(result), os_error(os_error) {
39 os_error(os_error) {
40 } 39 }
41 40
42 // static 41 // static
43 FileStream::Context::IOResult FileStream::Context::IOResult::FromOSError( 42 FileStream::Context::IOResult FileStream::Context::IOResult::FromOSError(
44 logging::SystemErrorCode os_error) { 43 logging::SystemErrorCode os_error) {
45 return IOResult(MapSystemError(os_error), os_error); 44 return IOResult(MapSystemError(os_error), os_error);
46 } 45 }
47 46
48 // --------------------------------------------------------------------- 47 // ---------------------------------------------------------------------
49 48
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 base::Bind(&Context::CloseFileImpl, base::Unretained(this)), 109 base::Bind(&Context::CloseFileImpl, base::Unretained(this)),
111 base::Bind(&Context::OnAsyncCompleted, 110 base::Bind(&Context::OnAsyncCompleted,
112 base::Unretained(this), 111 base::Unretained(this),
113 IntToInt64(callback))); 112 IntToInt64(callback)));
114 DCHECK(posted); 113 DCHECK(posted);
115 114
116 async_in_progress_ = true; 115 async_in_progress_ = true;
117 } 116 }
118 117
119 void FileStream::Context::Seek(base::File::Whence whence, 118 void FileStream::Context::Seek(base::File::Whence whence,
120 int64 offset, 119 int64_t offset,
121 const Int64CompletionCallback& callback) { 120 const Int64CompletionCallback& callback) {
122 DCHECK(!async_in_progress_); 121 DCHECK(!async_in_progress_);
123 122
124 bool posted = base::PostTaskAndReplyWithResult( 123 bool posted = base::PostTaskAndReplyWithResult(
125 task_runner_.get(), 124 task_runner_.get(),
126 FROM_HERE, 125 FROM_HERE,
127 base::Bind( 126 base::Bind(
128 &Context::SeekFileImpl, base::Unretained(this), whence, offset), 127 &Context::SeekFileImpl, base::Unretained(this), whence, offset),
129 base::Bind(&Context::OnAsyncCompleted, 128 base::Bind(&Context::OnAsyncCompleted,
130 base::Unretained(this), 129 base::Unretained(this),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // should be reset before Close() because it shouldn't run if any async 235 // should be reset before Close() because it shouldn't run if any async
237 // operation is in progress. 236 // operation is in progress.
238 async_in_progress_ = false; 237 async_in_progress_ = false;
239 if (orphaned_) 238 if (orphaned_)
240 CloseAndDelete(); 239 CloseAndDelete();
241 else 240 else
242 callback.Run(result.result); 241 callback.Run(result.result);
243 } 242 }
244 243
245 } // namespace net 244 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698