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

Side by Side Diff: net/http/http_network_transaction.cc

Issue 9350060: net: Make UploadDataStream::Init() asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « net/base/upload_data_stream_unittest.cc ('k') | net/http/http_stream_parser_unittest.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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/format_macros.h" 13 #include "base/format_macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/metrics/stats_counters.h" 17 #include "base/metrics/stats_counters.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/string_number_conversions.h" 19 #include "base/string_number_conversions.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/stringprintf.h" 21 #include "base/stringprintf.h"
22 #include "base/threading/thread_restrictions.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 #include "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
24 #include "net/base/auth.h" 25 #include "net/base/auth.h"
25 #include "net/base/host_port_pair.h" 26 #include "net/base/host_port_pair.h"
26 #include "net/base/io_buffer.h" 27 #include "net/base/io_buffer.h"
27 #include "net/base/load_flags.h" 28 #include "net/base/load_flags.h"
28 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
29 #include "net/base/net_util.h" 30 #include "net/base/net_util.h"
30 #include "net/base/ssl_cert_request_info.h" 31 #include "net/base/ssl_cert_request_info.h"
31 #include "net/base/ssl_connection_status_flags.h" 32 #include "net/base/ssl_connection_status_flags.h"
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 &request_headers_); 727 &request_headers_);
727 728
728 request_headers_.MergeFrom(request_->extra_headers); 729 request_headers_.MergeFrom(request_->extra_headers);
729 } 730 }
730 731
731 int HttpNetworkTransaction::DoBuildRequest() { 732 int HttpNetworkTransaction::DoBuildRequest() {
732 next_state_ = STATE_BUILD_REQUEST_COMPLETE; 733 next_state_ = STATE_BUILD_REQUEST_COMPLETE;
733 request_body_.reset(NULL); 734 request_body_.reset(NULL);
734 if (request_->upload_data) { 735 if (request_->upload_data) {
735 request_body_.reset(new UploadDataStream(request_->upload_data)); 736 request_body_.reset(new UploadDataStream(request_->upload_data));
736 const int error_code = request_body_->Init(); 737 // InitSync() performs file IO. crbug.com/113669.
738 base::ThreadRestrictions::ScopedAllowIO allow_io;
739 const int error_code = request_body_->InitSync();
737 if (error_code != OK) { 740 if (error_code != OK) {
738 request_body_.reset(NULL); 741 request_body_.reset(NULL);
739 return error_code; 742 return error_code;
740 } 743 }
741 } 744 }
742 745
743 headers_valid_ = false; 746 headers_valid_ = false;
744 747
745 // This is constructed lazily (instead of within our Start method), so that 748 // This is constructed lazily (instead of within our Start method), so that
746 // we have proxy info available. 749 // we have proxy info available.
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1355 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1353 state); 1356 state);
1354 break; 1357 break;
1355 } 1358 }
1356 return description; 1359 return description;
1357 } 1360 }
1358 1361
1359 #undef STATE_CASE 1362 #undef STATE_CASE
1360 1363
1361 } // namespace net 1364 } // namespace net
OLDNEW
« no previous file with comments | « net/base/upload_data_stream_unittest.cc ('k') | net/http/http_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698