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

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

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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_base.h" 5 #include "content/child/fileapi/webfilewriter_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebFileError.h" 8 #include "third_party/WebKit/public/platform/WebFileError.h"
9 #include "third_party/WebKit/public/platform/WebFileWriterClient.h" 9 #include "third_party/WebKit/public/platform/WebFileWriterClient.h"
10 #include "third_party/WebKit/public/platform/WebURL.h" 10 #include "third_party/WebKit/public/platform/WebURL.h"
(...skipping 14 matching lines...) Expand all
25 25
26 void WebFileWriterBase::truncate(long long length) { 26 void WebFileWriterBase::truncate(long long length) {
27 DCHECK(kOperationNone == operation_); 27 DCHECK(kOperationNone == operation_);
28 DCHECK(kCancelNotInProgress == cancel_state_); 28 DCHECK(kCancelNotInProgress == cancel_state_);
29 operation_ = kOperationTruncate; 29 operation_ = kOperationTruncate;
30 DoTruncate(path_, length); 30 DoTruncate(path_, length);
31 } 31 }
32 32
33 void WebFileWriterBase::write(long long position, 33 void WebFileWriterBase::write(long long position,
34 const WebKit::WebURL& blob_url) { 34 const WebKit::WebURL& blob_url) {
35 DCHECK(kOperationNone == operation_); 35 DCHECK_EQ(kOperationNone, operation_);
36 DCHECK(kCancelNotInProgress == cancel_state_); 36 DCHECK_EQ(kCancelNotInProgress, cancel_state_);
37 operation_ = kOperationWrite; 37 operation_ = kOperationWrite;
38 DoWrite(path_, blob_url, position); 38 DoWriteDeprecated(path_, blob_url, position);
39 }
40
41 void WebFileWriterBase::write(
42 long long position,
43 const WebKit::WebString& id) {
44 DCHECK_EQ(kOperationNone, operation_);
45 DCHECK_EQ(kCancelNotInProgress, cancel_state_);
46 operation_ = kOperationWrite;
47 DoWrite(path_, id.utf8(), position);
39 } 48 }
40 49
41 // When we cancel a write/truncate, we always get back the result of the write 50 // When we cancel a write/truncate, we always get back the result of the write
42 // before the result of the cancel, no matter what happens. 51 // before the result of the cancel, no matter what happens.
43 // So we'll get back either 52 // So we'll get back either
44 // success [of the write/truncate, in a DidWrite(XXX, true)/DidSucceed() call] 53 // success [of the write/truncate, in a DidWrite(XXX, true)/DidSucceed() call]
45 // followed by failure [of the cancel]; or 54 // followed by failure [of the cancel]; or
46 // failure [of the write, either from cancel or other reasons] followed by 55 // failure [of the write, either from cancel or other reasons] followed by
47 // the result of the cancel. 56 // the result of the cancel.
48 // In the write case, there could also be queued up non-terminal DidWrite calls 57 // In the write case, there could also be queued up non-terminal DidWrite calls
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 152
144 void WebFileWriterBase::FinishCancel() { 153 void WebFileWriterBase::FinishCancel() {
145 DCHECK(kCancelReceivedWriteResponse == cancel_state_); 154 DCHECK(kCancelReceivedWriteResponse == cancel_state_);
146 DCHECK(kOperationNone != operation_); 155 DCHECK(kOperationNone != operation_);
147 cancel_state_ = kCancelNotInProgress; 156 cancel_state_ = kCancelNotInProgress;
148 operation_ = kOperationNone; 157 operation_ = kOperationNone;
149 client_->didFail(WebKit::WebFileErrorAbort); 158 client_->didFail(WebKit::WebFileErrorAbort);
150 } 159 }
151 160
152 } // namespace content 161 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilewriter_base.h ('k') | content/child/fileapi/webfilewriter_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698