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

Side by Side Diff: content/child/fileapi/webfilewriter_impl.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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
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/webfilewriter_impl.h" 5 #include "content/child/fileapi/webfilewriter_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "content/child/child_thread.h" 10 #include "content/child/child_thread.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 friend class base::RefCountedThreadSafe<WriterBridge>; 86 friend class base::RefCountedThreadSafe<WriterBridge>;
87 virtual ~WriterBridge() {} 87 virtual ~WriterBridge() {}
88 88
89 void DidWrite(int64 bytes, bool complete) { 89 void DidWrite(int64 bytes, bool complete) {
90 written_bytes_ += bytes; 90 written_bytes_ += bytes;
91 if (waitable_event_ && !complete) 91 if (waitable_event_ && !complete)
92 return; 92 return;
93 PostTaskToWorker(base::Bind(write_callback_, written_bytes_, complete)); 93 PostTaskToWorker(base::Bind(write_callback_, written_bytes_, complete));
94 } 94 }
95 95
96 void DidFinish(base::PlatformFileError status) { 96 void DidFinish(base::File::Error status) {
97 PostTaskToWorker(base::Bind(status_callback_, status)); 97 PostTaskToWorker(base::Bind(status_callback_, status));
98 } 98 }
99 99
100 void PostTaskToWorker(const base::Closure& closure) { 100 void PostTaskToWorker(const base::Closure& closure) {
101 written_bytes_ = 0; 101 written_bytes_ = 0;
102 if (!thread_id_) { 102 if (!thread_id_) {
103 DCHECK(!waitable_event_); 103 DCHECK(!waitable_event_);
104 closure.Run(); 104 closure.Run();
105 return; 105 return;
106 } 106 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DCHECK(!bridge_->waitable_event()); 157 DCHECK(!bridge_->waitable_event());
158 closure.Run(); 158 closure.Run();
159 return; 159 return;
160 } 160 }
161 main_thread_loop_->PostTask(FROM_HERE, closure); 161 main_thread_loop_->PostTask(FROM_HERE, closure);
162 if (bridge_->waitable_event()) 162 if (bridge_->waitable_event())
163 bridge_->WaitAndRun(); 163 bridge_->WaitAndRun();
164 } 164 }
165 165
166 } // namespace content 166 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilewriter_base_unittest.cc ('k') | content/common/file_utilities_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698