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

Side by Side Diff: webkit/fileapi/upload_file_system_file_element_reader.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win Created 7 years, 11 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "webkit/fileapi/upload_file_system_file_element_reader.h" 5 #include "webkit/fileapi/upload_file_system_file_element_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "webkit/blob/file_stream_reader.h" 9 #include "webkit/blob/file_stream_reader.h"
10 #include "webkit/fileapi/file_system_context.h" 10 #include "webkit/fileapi/file_system_context.h"
(...skipping 23 matching lines...) Expand all
34 int UploadFileSystemFileElementReader::Init( 34 int UploadFileSystemFileElementReader::Init(
35 const net::CompletionCallback& callback) { 35 const net::CompletionCallback& callback) {
36 // Reset states. 36 // Reset states.
37 weak_ptr_factory_.InvalidateWeakPtrs(); 37 weak_ptr_factory_.InvalidateWeakPtrs();
38 stream_length_ = 0; 38 stream_length_ = 0;
39 position_ = 0; 39 position_ = 0;
40 40
41 // Initialize the stream reader and the length. 41 // Initialize the stream reader and the length.
42 stream_reader_.reset( 42 stream_reader_.reset(
43 file_system_context_->CreateFileStreamReader( 43 file_system_context_->CreateFileStreamReader(
44 FileSystemURL(url_), range_offset_, expected_modification_time_)); 44 file_system_context_->CrackURL(url_),
45 range_offset_,
46 expected_modification_time_));
45 DCHECK(stream_reader_); 47 DCHECK(stream_reader_);
46 48
47 const int result = stream_reader_->GetLength( 49 const int result = stream_reader_->GetLength(
48 base::Bind(&UploadFileSystemFileElementReader::OnGetLength, 50 base::Bind(&UploadFileSystemFileElementReader::OnGetLength,
49 weak_ptr_factory_.GetWeakPtr(), 51 weak_ptr_factory_.GetWeakPtr(),
50 callback)); 52 callback));
51 if (result >= 0) { 53 if (result >= 0) {
52 stream_length_ = result; 54 stream_length_ = result;
53 return net::OK; 55 return net::OK;
54 } 56 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 int result) { 104 int result) {
103 if (result > 0) { 105 if (result > 0) {
104 position_ += result; 106 position_ += result;
105 DCHECK_LE(position_, GetContentLength()); 107 DCHECK_LE(position_, GetContentLength());
106 } 108 }
107 if (!callback.is_null()) 109 if (!callback.is_null())
108 callback.Run(result); 110 callback.Run(result);
109 } 111 }
110 112
111 } // namespace fileapi 113 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698