| 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 "content/common/fileapi/file_system_dispatcher.h" | 5 #include "content/common/fileapi/file_system_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/process.h" | 8 #include "base/process.h" |
| 9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
| 10 #include "content/common/fileapi/file_system_messages.h" | 10 #include "content/common/fileapi/file_system_messages.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return false; | 178 return false; |
| 179 } | 179 } |
| 180 | 180 |
| 181 if (request_id_out) | 181 if (request_id_out) |
| 182 *request_id_out = request_id; | 182 *request_id_out = request_id; |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool FileSystemDispatcher::Write( | 186 bool FileSystemDispatcher::Write( |
| 187 const GURL& path, | 187 const GURL& path, |
| 188 const GURL& blob_url, | 188 const std::string& blob_uuid, |
| 189 int64 offset, | 189 int64 offset, |
| 190 int* request_id_out, | 190 int* request_id_out, |
| 191 fileapi::FileSystemCallbackDispatcher* dispatcher) { | 191 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 192 int request_id = dispatchers_.Add(dispatcher); | 192 int request_id = dispatchers_.Add(dispatcher); |
| 193 if (!ChildThread::current()->Send( | 193 if (!ChildThread::current()->Send( |
| 194 new FileSystemHostMsg_Write(request_id, path, blob_url, offset))) { | 194 new FileSystemHostMsg_Write(request_id, path, blob_uuid, offset))) { |
| 195 dispatchers_.Remove(request_id); // destroys |dispatcher| | 195 dispatchers_.Remove(request_id); // destroys |dispatcher| |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 | 198 |
| 199 if (request_id_out) | 199 if (request_id_out) |
| 200 *request_id_out = request_id; | 200 *request_id_out = request_id; |
| 201 return true; | 201 return true; |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool FileSystemDispatcher::Cancel( | 204 bool FileSystemDispatcher::Cancel( |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 void FileSystemDispatcher::OnDidOpenFile( | 351 void FileSystemDispatcher::OnDidOpenFile( |
| 352 int request_id, IPC::PlatformFileForTransit file) { | 352 int request_id, IPC::PlatformFileForTransit file) { |
| 353 fileapi::FileSystemCallbackDispatcher* dispatcher = | 353 fileapi::FileSystemCallbackDispatcher* dispatcher = |
| 354 dispatchers_.Lookup(request_id); | 354 dispatchers_.Lookup(request_id); |
| 355 DCHECK(dispatcher); | 355 DCHECK(dispatcher); |
| 356 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); | 356 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); |
| 357 dispatchers_.Remove(request_id); | 357 dispatchers_.Remove(request_id); |
| 358 } | 358 } |
| 359 | 359 |
| 360 } // namespace content | 360 } // namespace content |
| OLD | NEW |