| 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 "webkit/fileapi/local_file_system_operation.h" | 5 #include "webkit/fileapi/local_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 peer_handle_(base::kNullProcessHandle), | 46 peer_handle_(base::kNullProcessHandle), |
| 47 pending_operation_(kOperationNone), | 47 pending_operation_(kOperationNone), |
| 48 weak_factory_(this) { | 48 weak_factory_(this) { |
| 49 DCHECK(operation_context_.get()); | 49 DCHECK(operation_context_.get()); |
| 50 operation_context_->DetachUserDataThread(); | 50 operation_context_->DetachUserDataThread(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 LocalFileSystemOperation::~LocalFileSystemOperation() { | 53 LocalFileSystemOperation::~LocalFileSystemOperation() { |
| 54 if (!operation_context()) | 54 if (!operation_context()) |
| 55 return; | 55 return; |
| 56 operation_context()->DetachUserDataThread(); | |
| 57 if (write_target_url_.is_valid()) { | 56 if (write_target_url_.is_valid()) { |
| 58 operation_context()->update_observers()->Notify( | 57 operation_context()->update_observers()->Notify( |
| 59 &FileUpdateObserver::OnEndUpdate, MakeTuple(write_target_url_)); | 58 &FileUpdateObserver::OnEndUpdate, MakeTuple(write_target_url_)); |
| 60 } | 59 } |
| 61 } | 60 } |
| 62 | 61 |
| 63 void LocalFileSystemOperation::CreateFile(const FileSystemURL& url, | 62 void LocalFileSystemOperation::CreateFile(const FileSystemURL& url, |
| 64 bool exclusive, | 63 bool exclusive, |
| 65 const StatusCallback& callback) { | 64 const StatusCallback& callback) { |
| 66 DCHECK(SetPendingOperationType(kOperationCreateFile)); | 65 DCHECK(SetPendingOperationType(kOperationCreateFile)); |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 } | 871 } |
| 873 | 872 |
| 874 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { | 873 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { |
| 875 if (pending_operation_ != kOperationNone) | 874 if (pending_operation_ != kOperationNone) |
| 876 return false; | 875 return false; |
| 877 pending_operation_ = type; | 876 pending_operation_ = type; |
| 878 return true; | 877 return true; |
| 879 } | 878 } |
| 880 | 879 |
| 881 } // namespace fileapi | 880 } // namespace fileapi |
| OLD | NEW |