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

Side by Side Diff: net/base/upload_file_element_reader.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/base/sdch_manager_unittest.cc ('k') | net/cert/cert_database_win.cc » ('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 (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 "net/base/upload_file_element_reader.h" 5 #include "net/base/upload_file_element_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/profiler/scoped_profile.h" 10 #include "base/profiler/scoped_tracker.h"
11 #include "base/task_runner_util.h" 11 #include "base/task_runner_util.h"
12 #include "net/base/file_stream.h" 12 #include "net/base/file_stream.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 namespace { 18 namespace {
19 19
20 // In tests, this value is used to override the return value of 20 // In tests, this value is used to override the return value of
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void UploadFileElementReader::Reset() { 97 void UploadFileElementReader::Reset() {
98 weak_ptr_factory_.InvalidateWeakPtrs(); 98 weak_ptr_factory_.InvalidateWeakPtrs();
99 bytes_remaining_ = 0; 99 bytes_remaining_ = 0;
100 content_length_ = 0; 100 content_length_ = 0;
101 file_stream_.reset(); 101 file_stream_.reset();
102 } 102 }
103 103
104 void UploadFileElementReader::OnOpenCompleted( 104 void UploadFileElementReader::OnOpenCompleted(
105 const CompletionCallback& callback, 105 const CompletionCallback& callback,
106 int result) { 106 int result) {
107 // TODO(vadimt): Remove ScopedProfile below once crbug.com/423948 is fixed. 107 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
108 tracked_objects::ScopedProfile tracking_profile( 108 tracked_objects::ScopedTracker tracking_profile(
109 FROM_HERE_WITH_EXPLICIT_FUNCTION( 109 FROM_HERE_WITH_EXPLICIT_FUNCTION(
110 "423948 UploadFileElementReader::OnOpenCompleted")); 110 "423948 UploadFileElementReader::OnOpenCompleted"));
111 111
112 DCHECK(!callback.is_null()); 112 DCHECK(!callback.is_null());
113 113
114 if (result < 0) { 114 if (result < 0) {
115 DLOG(WARNING) << "Failed to open \"" << path_.value() 115 DLOG(WARNING) << "Failed to open \"" << path_.value()
116 << "\" for reading: " << result; 116 << "\" for reading: " << result;
117 callback.Run(result); 117 callback.Run(result);
118 return; 118 return;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ScopedOverridingContentLengthForTests(uint64 value) { 209 ScopedOverridingContentLengthForTests(uint64 value) {
210 overriding_content_length = value; 210 overriding_content_length = value;
211 } 211 }
212 212
213 UploadFileElementReader::ScopedOverridingContentLengthForTests:: 213 UploadFileElementReader::ScopedOverridingContentLengthForTests::
214 ~ScopedOverridingContentLengthForTests() { 214 ~ScopedOverridingContentLengthForTests() {
215 overriding_content_length = 0; 215 overriding_content_length = 0;
216 } 216 }
217 217
218 } // namespace net 218 } // namespace net
OLDNEW
« no previous file with comments | « net/base/sdch_manager_unittest.cc ('k') | net/cert/cert_database_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698