| OLD | NEW |
| 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 "storage/browser/fileapi/local_file_stream_writer.h" | 5 #include "storage/browser/fileapi/local_file_stream_writer.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/profiler/scoped_profile.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
| 11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 | 13 |
| 14 namespace storage { | 14 namespace storage { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 const int kOpenFlagsForWrite = base::File::FLAG_OPEN | | 18 const int kOpenFlagsForWrite = base::File::FLAG_OPEN | |
| 19 base::File::FLAG_WRITE | | 19 base::File::FLAG_WRITE | |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 base::Bind(&LocalFileStreamWriter::DidOpen, | 119 base::Bind(&LocalFileStreamWriter::DidOpen, |
| 120 weak_factory_.GetWeakPtr(), | 120 weak_factory_.GetWeakPtr(), |
| 121 error_callback, | 121 error_callback, |
| 122 main_operation)); | 122 main_operation)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void LocalFileStreamWriter::DidOpen( | 125 void LocalFileStreamWriter::DidOpen( |
| 126 const net::CompletionCallback& error_callback, | 126 const net::CompletionCallback& error_callback, |
| 127 const base::Closure& main_operation, | 127 const base::Closure& main_operation, |
| 128 int result) { | 128 int result) { |
| 129 // TODO(vadimt): Remove ScopedProfile below once crbug.com/423948 is fixed. | 129 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. |
| 130 tracked_objects::ScopedProfile tracking_profile( | 130 tracked_objects::ScopedTracker tracking_profile( |
| 131 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 131 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 132 "423948 LocalFileStreamWriter::DidOpen")); | 132 "423948 LocalFileStreamWriter::DidOpen")); |
| 133 | 133 |
| 134 DCHECK(has_pending_operation_); | 134 DCHECK(has_pending_operation_); |
| 135 DCHECK(stream_impl_.get()); | 135 DCHECK(stream_impl_.get()); |
| 136 | 136 |
| 137 if (CancelIfRequested()) | 137 if (CancelIfRequested()) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 if (result != net::OK) { | 140 if (result != net::OK) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 return false; | 254 return false; |
| 255 | 255 |
| 256 net::CompletionCallback pending_cancel = cancel_callback_; | 256 net::CompletionCallback pending_cancel = cancel_callback_; |
| 257 has_pending_operation_ = false; | 257 has_pending_operation_ = false; |
| 258 cancel_callback_.Reset(); | 258 cancel_callback_.Reset(); |
| 259 pending_cancel.Run(net::OK); | 259 pending_cancel.Run(net::OK); |
| 260 return true; | 260 return true; |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace storage | 263 } // namespace storage |
| OLD | NEW |