Return timing information for custom requests to avoid crash in WebKit (issue #1259).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1763 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
8313963a27
commit
49fa439594
|
@ -164,6 +164,7 @@ CefResourceRequestJob::~CefResourceRequestJob() {
|
|||
void CefResourceRequestJob::Start() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
request_start_time_ = base::Time::Now();
|
||||
cef_request_ = CefRequest::Create();
|
||||
|
||||
// Populate the request data.
|
||||
|
@ -285,6 +286,16 @@ void CefResourceRequestJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
|||
info->headers = GetResponseHeaders();
|
||||
}
|
||||
|
||||
void CefResourceRequestJob::GetLoadTimingInfo(
|
||||
net::LoadTimingInfo* load_timing_info) const {
|
||||
// If haven't made it far enough to receive any headers, don't return
|
||||
// anything. This makes for more consistent behavior in the case of errors.
|
||||
if (!response_ || receive_headers_end_.is_null())
|
||||
return;
|
||||
load_timing_info->request_start_time = request_start_time_;
|
||||
load_timing_info->receive_headers_end = receive_headers_end_;
|
||||
}
|
||||
|
||||
bool CefResourceRequestJob::GetResponseCookies(
|
||||
std::vector<std::string>* cookies) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
@ -349,6 +360,7 @@ void CefResourceRequestJob::SendHeaders() {
|
|||
|
||||
// Get header information from the handler.
|
||||
handler_->GetResponseHeaders(response_, remaining_bytes_, redirectUrl);
|
||||
receive_headers_end_ = base::TimeTicks::Now();
|
||||
if (!redirectUrl.empty()) {
|
||||
std::string redirectUrlStr = redirectUrl;
|
||||
redirect_url_ = GURL(redirectUrlStr);
|
||||
|
|
|
@ -36,6 +36,8 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
|||
virtual bool ReadRawData(net::IOBuffer* dest, int dest_size, int* bytes_read)
|
||||
OVERRIDE;
|
||||
virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE;
|
||||
virtual void GetLoadTimingInfo(
|
||||
net::LoadTimingInfo* load_timing_info) const OVERRIDE;
|
||||
virtual bool GetResponseCookies(std::vector<std::string>* cookies) OVERRIDE;
|
||||
virtual bool IsRedirectResponse(GURL* location, int* http_status_code)
|
||||
OVERRIDE;
|
||||
|
@ -69,6 +71,10 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
|||
scoped_refptr<net::HttpResponseHeaders> response_headers_;
|
||||
std::vector<std::string> response_cookies_;
|
||||
size_t response_cookies_save_index_;
|
||||
base::Time request_start_time_;
|
||||
base::TimeTicks receive_headers_end_;
|
||||
|
||||
// Must be the last member.
|
||||
base::WeakPtrFactory<CefResourceRequestJob> weak_factory_;
|
||||
|
||||
friend class CefResourceRequestJobCallback;
|
||||
|
|
Loading…
Reference in New Issue