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

Side by Side Diff: chrome_frame/urlmon_url_request.cc

Issue 3061036: Handle automation server crashes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « chrome_frame/test_utils.cc ('k') | chrome_frame/utils.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome_frame/urlmon_url_request.h" 5 #include "chrome_frame/urlmon_url_request.h"
6 6
7 #include <wininet.h> 7 #include <wininet.h>
8 #include <urlmon.h> 8 #include <urlmon.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Just drop the data. 177 // Just drop the data.
178 } 178 }
179 DLOG_IF(WARNING, hr != E_PENDING) << __FUNCTION__ << 179 DLOG_IF(WARNING, hr != E_PENDING) << __FUNCTION__ <<
180 StringPrintf(" expected E_PENDING but got 0x%08X", hr); 180 StringPrintf(" expected E_PENDING but got 0x%08X", hr);
181 } 181 }
182 } 182 }
183 } 183 }
184 184
185 size_t UrlmonUrlRequest::SendDataToDelegate(size_t bytes_to_read) { 185 size_t UrlmonUrlRequest::SendDataToDelegate(size_t bytes_to_read) {
186 DCHECK_EQ(thread_, PlatformThread::CurrentId()); 186 DCHECK_EQ(thread_, PlatformThread::CurrentId());
187 DCHECK(id() != -1); 187 DCHECK_NE(id(), -1);
188 DCHECK_GT(bytes_to_read, 0U); 188 DCHECK_GT(bytes_to_read, 0U);
189 size_t bytes_copied = 0; 189 size_t bytes_copied = 0;
190 if (delegate_) { 190 if (delegate_) {
191 std::string read_data; 191 std::string read_data;
192 if (cache_) { 192 if (cache_) {
193 HRESULT hr = ReadStream(cache_, bytes_to_read, &read_data); 193 HRESULT hr = ReadStream(cache_, bytes_to_read, &read_data);
194 if (hr == S_FALSE || read_data.length() < bytes_to_read) { 194 if (hr == S_FALSE || read_data.length() < bytes_to_read) {
195 DLOG(INFO) << __FUNCTION__ << me() << "all cached data read"; 195 DLOG(INFO) << __FUNCTION__ << me() << "all cached data read";
196 cache_.Release(); 196 cache_.Release();
197 } 197 }
(...skipping 15 matching lines...) Expand all
213 // stream. Clear it to ensure that OnStopBinding correctly sends over the 213 // stream. Clear it to ensure that OnStopBinding correctly sends over the
214 // response end notification to chrome. 214 // response end notification to chrome.
215 if (hr == S_FALSE) 215 if (hr == S_FALSE)
216 pending_data_.Release(); 216 pending_data_.Release();
217 } 217 }
218 218
219 bytes_copied = read_data.length(); 219 bytes_copied = read_data.length();
220 220
221 if (bytes_copied) { 221 if (bytes_copied) {
222 ++calling_delegate_; 222 ++calling_delegate_;
223 DCHECK(id() != -1); 223 DCHECK_NE(id(), -1);
224 delegate_->OnReadComplete(id(), read_data); 224 delegate_->OnReadComplete(id(), read_data);
225 --calling_delegate_; 225 --calling_delegate_;
226 } 226 }
227 } else { 227 } else {
228 DLOG(ERROR) << __FUNCTION__ << me() << "no delegate"; 228 DLOG(ERROR) << __FUNCTION__ << me() << "no delegate";
229 } 229 }
230 230
231 return bytes_copied; 231 return bytes_copied;
232 } 232 }
233 233
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // The network policy in Chrome network is that error code/end_of_stream 368 // The network policy in Chrome network is that error code/end_of_stream
369 // should be returned only as a result of read (or start) request. 369 // should be returned only as a result of read (or start) request.
370 // Here are the possible cases: 370 // Here are the possible cases:
371 // pending_data_|pending_read 371 // pending_data_|pending_read
372 // FALSE |FALSE => EndRequest if no headers, otherwise wait for Read. 372 // FALSE |FALSE => EndRequest if no headers, otherwise wait for Read.
373 // FALSE |TRUE => EndRequest. 373 // FALSE |TRUE => EndRequest.
374 // TRUE |FALSE => Wait for Read. 374 // TRUE |FALSE => Wait for Read.
375 // TRUE |TRUE => Something went wrong!! 375 // TRUE |TRUE => Something went wrong!!
376 376
377 if (pending_data_) { 377 if (pending_data_) {
378 DCHECK(pending_read_size_ == 0); 378 DCHECK_EQ(pending_read_size_, 0UL);
379 ReleaseBindings(); 379 ReleaseBindings();
380 return S_OK; 380 return S_OK;
381 } 381 }
382 382
383 if (headers_received_ && pending_read_size_ == 0) { 383 if (headers_received_ && pending_read_size_ == 0) {
384 ReleaseBindings(); 384 ReleaseBindings();
385 return S_OK; 385 return S_OK;
386 } 386 }
387 387
388 // No headers or there is a pending read from Chrome. 388 // No headers or there is a pending read from Chrome.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 DLOG(ERROR) << "X-Frame-Options header other than ALLOWALL " << 612 DLOG(ERROR) << "X-Frame-Options header other than ALLOWALL " <<
613 "detected, navigation canceled"; 613 "detected, navigation canceled";
614 return E_FAIL; 614 return E_FAIL;
615 } 615 }
616 } 616 }
617 617
618 DLOG(INFO) << __FUNCTION__ << me() << "Calling OnResponseStarted"; 618 DLOG(INFO) << __FUNCTION__ << me() << "Calling OnResponseStarted";
619 619
620 // Inform the delegate. 620 // Inform the delegate.
621 headers_received_ = true; 621 headers_received_ = true;
622 DCHECK(id() != -1); 622 DCHECK_NE(id(), -1);
623 delegate_->OnResponseStarted(id(), 623 delegate_->OnResponseStarted(id(),
624 "", // mime_type 624 "", // mime_type
625 raw_headers.c_str(), // headers 625 raw_headers.c_str(), // headers
626 0, // size 626 0, // size
627 base::Time(), // last_modified 627 base::Time(), // last_modified
628 status_.get_redirection().utf8_url, 628 status_.get_redirection().utf8_url,
629 status_.get_redirection().http_code); 629 status_.get_redirection().http_code);
630 return S_OK; 630 return S_OK;
631 } 631 }
632 632
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 bool is_started = pending_request_->Start(); 901 bool is_started = pending_request_->Start();
902 DCHECK(is_started); 902 DCHECK(is_started);
903 } 903 }
904 } 904 }
905 905
906 void UrlmonUrlRequestManager::StartRequest(int request_id, 906 void UrlmonUrlRequestManager::StartRequest(int request_id,
907 const IPC::AutomationURLRequest& request_info) { 907 const IPC::AutomationURLRequest& request_info) {
908 DLOG(INFO) << __FUNCTION__ << " id: " << request_id; 908 DLOG(INFO) << __FUNCTION__ << " id: " << request_id;
909 DCHECK_EQ(0, calling_delegate_); 909 DCHECK_EQ(0, calling_delegate_);
910 910
911 if (stopping_) 911 if (stopping_) {
912 DLOG(WARNING) << __FUNCTION__ << " request not started (stopping)";
912 return; 913 return;
914 }
913 915
914 DCHECK(request_map_.find(request_id) == request_map_.end()); 916 DCHECK(request_map_.find(request_id) == request_map_.end());
915 DCHECK(GURL(request_info.url).is_valid()); 917 DCHECK(GURL(request_info.url).is_valid());
916 918
917 scoped_refptr<UrlmonUrlRequest> new_request; 919 scoped_refptr<UrlmonUrlRequest> new_request;
918 bool is_started = false; 920 bool is_started = false;
919 if (pending_request_) { 921 if (pending_request_) {
920 DCHECK_EQ(pending_request_->url(), request_info.url); 922 DCHECK_EQ(pending_request_->url(), request_info.url);
921 new_request.swap(pending_request_); 923 new_request.swap(pending_request_);
922 new_request->set_pending(false); 924 new_request->set_pending(false);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 privacy_info_.privacy_records[UTF8ToWide(url)]; 1161 privacy_info_.privacy_records[UTF8ToWide(url)];
1160 1162
1161 privacy_entry.flags |= flags; 1163 privacy_entry.flags |= flags;
1162 privacy_entry.policy_ref = UTF8ToWide(policy_ref); 1164 privacy_entry.policy_ref = UTF8ToWide(policy_ref);
1163 1165
1164 if (fire_privacy_event && IsWindow(notification_window_)) { 1166 if (fire_privacy_event && IsWindow(notification_window_)) {
1165 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, 1167 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1,
1166 0); 1168 0);
1167 } 1169 }
1168 } 1170 }
OLDNEW
« no previous file with comments | « chrome_frame/test_utils.cc ('k') | chrome_frame/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698