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

Side by Side Diff: net/flip/flip_network_transaction.cc

Issue 339047: Cleanup the FlipDelegate API a bit in prep for fixing upload.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « net/flip/flip_network_transaction.h ('k') | net/flip/flip_session.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/flip/flip_network_transaction.h" 5 #include "net/flip/flip_network_transaction.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/field_trial.h" 9 #include "base/field_trial.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 void FlipNetworkTransaction::OnRequestSent(int status) { 62 void FlipNetworkTransaction::OnRequestSent(int status) {
63 if (status == OK) 63 if (status == OK)
64 next_state_ = STATE_SEND_REQUEST_COMPLETE; 64 next_state_ = STATE_SEND_REQUEST_COMPLETE;
65 else 65 else
66 next_state_ = STATE_NONE; 66 next_state_ = STATE_NONE;
67 67
68 DoLoop(status); 68 DoLoop(status);
69 } 69 }
70 70
71 void FlipNetworkTransaction::OnUploadDataSent(int result) {
72 NOTIMPLEMENTED();
73 }
74
71 void FlipNetworkTransaction::OnResponseReceived(HttpResponseInfo* response) { 75 void FlipNetworkTransaction::OnResponseReceived(HttpResponseInfo* response) {
72 next_state_ = STATE_READ_HEADERS_COMPLETE; 76 next_state_ = STATE_READ_HEADERS_COMPLETE;
73 77
74 response_ = *response; // TODO(mbelshe): avoid copy. 78 response_ = *response; // TODO(mbelshe): avoid copy.
75 79
76 DoLoop(net::OK); 80 DoLoop(net::OK);
77 } 81 }
78 82
79 void FlipNetworkTransaction::OnDataReceived(const char* buffer, int bytes) { 83 void FlipNetworkTransaction::OnDataReceived(const char* buffer, int bytes) {
80 // TODO(mbelshe): if data is received before a syn reply, this will crash. 84 // TODO(mbelshe): if data is received before a syn reply, this will crash.
(...skipping 16 matching lines...) Expand all
97 } 101 }
98 102
99 void FlipNetworkTransaction::OnClose(int status) { 103 void FlipNetworkTransaction::OnClose(int status) {
100 next_state_ = STATE_READ_BODY_COMPLETE; 104 next_state_ = STATE_READ_BODY_COMPLETE;
101 response_complete_ = true; 105 response_complete_ = true;
102 response_status_ = status; 106 response_status_ = status;
103 flip_request_id_ = 0; // TODO(mbelshe) - do we need this? 107 flip_request_id_ = 0; // TODO(mbelshe) - do we need this?
104 DoLoop(status); 108 DoLoop(status);
105 } 109 }
106 110
107 void FlipNetworkTransaction::OnCancel() {
108 next_state_ = STATE_NONE;
109 response_complete_ = true;
110 response_status_ = net::ERR_ABORTED;
111 flip_request_id_ = 0; // TODO(mbelshe) - do we need this?
112 // Clear any data in our buffer.
113 while (response_body_.size())
114 response_body_.pop_front();
115 }
116
117 int FlipNetworkTransaction::Start(const HttpRequestInfo* request_info, 111 int FlipNetworkTransaction::Start(const HttpRequestInfo* request_info,
118 CompletionCallback* callback, 112 CompletionCallback* callback,
119 LoadLog* load_log) { 113 LoadLog* load_log) {
120 request_ = request_info; 114 request_ = request_info;
121 start_time_ = base::Time::Now(); 115 start_time_ = base::Time::Now();
122 116
123 next_state_ = STATE_INIT_CONNECTION; 117 next_state_ = STATE_INIT_CONNECTION;
124 int rv = DoLoop(OK); 118 int rv = DoLoop(OK);
125 if (rv == ERR_IO_PENDING) 119 if (rv == ERR_IO_PENDING)
126 user_callback_ = callback; 120 user_callback_ = callback;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 399 }
406 400
407 int FlipNetworkTransaction::DoReadBodyComplete(int result) { 401 int FlipNetworkTransaction::DoReadBodyComplete(int result) {
408 // TODO(mbelshe): record success or failure of the transaction? 402 // TODO(mbelshe): record success or failure of the transaction?
409 if (user_callback_) 403 if (user_callback_)
410 DoHttpTransactionCallback(result); 404 DoHttpTransactionCallback(result);
411 return OK; 405 return OK;
412 } 406 }
413 407
414 } // namespace net 408 } // namespace net
OLDNEW
« no previous file with comments | « net/flip/flip_network_transaction.h ('k') | net/flip/flip_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698