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

Side by Side Diff: trunk/src/content/child/fileapi/webfilesystem_impl.cc

Issue 22300004: Revert 215787 "Support synchronous mode in WebFileWriterImpl" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/content/child/fileapi/webfilewriter_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/webfilesystem_impl.h" 5 #include "content/child/fileapi/webfilesystem_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return; 245 return;
246 246
247 WebFileSystemCallbacks* callbacks = 247 WebFileSystemCallbacks* callbacks =
248 CallbacksMap::Get()->GetAndUnregisterCallbacks(callbacks_id); 248 CallbacksMap::Get()->GetAndUnregisterCallbacks(callbacks_id);
249 DCHECK(callbacks); 249 DCHECK(callbacks);
250 250
251 if (file_info.is_directory || file_info.size < 0) { 251 if (file_info.is_directory || file_info.size < 0) {
252 callbacks->didFail(WebKit::WebFileErrorInvalidState); 252 callbacks->didFail(WebKit::WebFileErrorInvalidState);
253 return; 253 return;
254 } 254 }
255 WebFileWriterImpl::Type type = callbacks->shouldBlockUntilCompletion() ?
256 WebFileWriterImpl::TYPE_SYNC : WebFileWriterImpl::TYPE_ASYNC;
257 callbacks->didCreateFileWriter( 255 callbacks->didCreateFileWriter(
258 new WebFileWriterImpl(path, client, type, main_thread_loop), 256 new WebFileWriterImpl(path, client, main_thread_loop), file_info.size);
259 file_info.size);
260 } 257 }
261 258
262 void CreateFileWriterCallbackAdapter( 259 void CreateFileWriterCallbackAdapter(
263 int thread_id, int callbacks_id, 260 int thread_id, int callbacks_id,
264 WaitableCallbackResults* waitable_results, 261 WaitableCallbackResults* waitable_results,
265 base::MessageLoopProxy* main_thread_loop, 262 base::MessageLoopProxy* main_thread_loop,
266 const GURL& path, 263 const GURL& path,
267 WebKit::WebFileWriterClient* client, 264 WebKit::WebFileWriterClient* client,
268 const base::PlatformFileInfo& file_info) { 265 const base::PlatformFileInfo& file_info) {
269 DispatchResultsClosure( 266 DispatchResultsClosure(
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 CurrentWorkerId(), callbacks_id, 481 CurrentWorkerId(), callbacks_id,
485 base::Unretained(waitable_results)), 482 base::Unretained(waitable_results)),
486 base::Bind(&StatusCallbackAdapter, 483 base::Bind(&StatusCallbackAdapter,
487 CurrentWorkerId(), callbacks_id, 484 CurrentWorkerId(), callbacks_id,
488 base::Unretained(waitable_results))), 485 base::Unretained(waitable_results))),
489 make_scoped_ptr(waitable_results)); 486 make_scoped_ptr(waitable_results));
490 } 487 }
491 488
492 WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( 489 WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter(
493 const WebURL& path, WebKit::WebFileWriterClient* client) { 490 const WebURL& path, WebKit::WebFileWriterClient* client) {
494 return new WebFileWriterImpl(GURL(path), client, 491 return new WebFileWriterImpl(GURL(path), client, main_thread_loop_.get());
495 WebFileWriterImpl::TYPE_ASYNC,
496 main_thread_loop_.get());
497 } 492 }
498 493
499 void WebFileSystemImpl::createFileWriter( 494 void WebFileSystemImpl::createFileWriter(
500 const WebURL& path, 495 const WebURL& path,
501 WebKit::WebFileWriterClient* client, 496 WebKit::WebFileWriterClient* client,
502 WebKit::WebFileSystemCallbacks* callbacks) { 497 WebKit::WebFileSystemCallbacks* callbacks) {
503 int callbacks_id = CallbacksMap::GetOrCreate()->RegisterCallbacks(callbacks); 498 int callbacks_id = CallbacksMap::GetOrCreate()->RegisterCallbacks(callbacks);
504 WaitableCallbackResults* waitable_results = 499 WaitableCallbackResults* waitable_results =
505 WaitableCallbackResults::MaybeCreate(callbacks); 500 WaitableCallbackResults::MaybeCreate(callbacks);
506 CallDispatcherOnMainThread( 501 CallDispatcherOnMainThread(
(...skipping 24 matching lines...) Expand all
531 CurrentWorkerId(), callbacks_id, 526 CurrentWorkerId(), callbacks_id,
532 base::Unretained(waitable_results), 527 base::Unretained(waitable_results),
533 main_thread_loop_), 528 main_thread_loop_),
534 base::Bind(&StatusCallbackAdapter, 529 base::Bind(&StatusCallbackAdapter,
535 CurrentWorkerId(), callbacks_id, 530 CurrentWorkerId(), callbacks_id,
536 base::Unretained(waitable_results))), 531 base::Unretained(waitable_results))),
537 make_scoped_ptr(waitable_results)); 532 make_scoped_ptr(waitable_results));
538 } 533 }
539 534
540 } // namespace content 535 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | trunk/src/content/child/fileapi/webfilewriter_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698