OLD | NEW |
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 "content/browser/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) { | 276 void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) { |
277 TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this); | 277 TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this); |
278 if (bytes) { | 278 if (bytes) { |
279 // The request completed, and we have all the data. | 279 // The request completed, and we have all the data. |
280 // Clear any IO pending status. | 280 // Clear any IO pending status. |
281 SetStatus(net::URLRequestStatus()); | 281 SetStatus(net::URLRequestStatus()); |
282 | 282 |
283 data_ = bytes; | 283 data_ = bytes; |
284 int bytes_read; | 284 int bytes_read; |
285 if (pending_buf_.get()) { | 285 if (pending_buf_) { |
286 CHECK(pending_buf_->data()); | 286 CHECK(pending_buf_->data()); |
287 CompleteRead(pending_buf_, pending_buf_size_, &bytes_read); | 287 CompleteRead(pending_buf_, pending_buf_size_, &bytes_read); |
288 pending_buf_ = NULL; | 288 pending_buf_ = NULL; |
289 NotifyReadComplete(bytes_read); | 289 NotifyReadComplete(bytes_read); |
290 } | 290 } |
291 } else { | 291 } else { |
292 // The request failed. | 292 // The request failed. |
293 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 293 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
294 net::ERR_FAILED)); | 294 net::ERR_FAILED)); |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size, | 298 bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size, |
299 int* bytes_read) { | 299 int* bytes_read) { |
300 if (!data_.get()) { | 300 if (!data_) { |
301 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); | 301 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); |
302 DCHECK(!pending_buf_.get()); | 302 DCHECK(!pending_buf_.get()); |
303 CHECK(buf->data()); | 303 CHECK(buf->data()); |
304 pending_buf_ = buf; | 304 pending_buf_ = buf; |
305 pending_buf_size_ = buf_size; | 305 pending_buf_size_ = buf_size; |
306 return false; // Tell the caller we're still waiting for data. | 306 return false; // Tell the caller we're still waiting for data. |
307 } | 307 } |
308 | 308 |
309 // Otherwise, the data is available. | 309 // Otherwise, the data is available. |
310 CompleteRead(buf, buf_size, bytes_read); | 310 CompleteRead(buf, buf_size, bytes_read); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 623 |
624 } // namespace | 624 } // namespace |
625 | 625 |
626 net::URLRequestJobFactory::ProtocolHandler* | 626 net::URLRequestJobFactory::ProtocolHandler* |
627 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 627 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
628 bool is_incognito) { | 628 bool is_incognito) { |
629 return new DevToolsJobFactory(resource_context, is_incognito); | 629 return new DevToolsJobFactory(resource_context, is_incognito); |
630 } | 630 } |
631 | 631 |
632 } // namespace content | 632 } // namespace content |
OLD | NEW |