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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this); | 330 TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this); |
331 if (bytes) { | 331 if (bytes) { |
332 // The request completed, and we have all the data. | 332 // The request completed, and we have all the data. |
333 // Clear any IO pending status. | 333 // Clear any IO pending status. |
334 SetStatus(net::URLRequestStatus()); | 334 SetStatus(net::URLRequestStatus()); |
335 | 335 |
336 data_ = bytes; | 336 data_ = bytes; |
337 int bytes_read; | 337 int bytes_read; |
338 if (pending_buf_.get()) { | 338 if (pending_buf_.get()) { |
339 CHECK(pending_buf_->data()); | 339 CHECK(pending_buf_->data()); |
| 340 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455423 is |
| 341 // fixed. |
| 342 tracked_objects::ScopedTracker tracking_profile( |
| 343 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 344 "455423 URLRequestChromeJob::CompleteRead")); |
340 CompleteRead(pending_buf_.get(), pending_buf_size_, &bytes_read); | 345 CompleteRead(pending_buf_.get(), pending_buf_size_, &bytes_read); |
341 pending_buf_ = NULL; | 346 pending_buf_ = NULL; |
342 NotifyReadComplete(bytes_read); | 347 NotifyReadComplete(bytes_read); |
343 } | 348 } |
344 } else { | 349 } else { |
| 350 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455423 is |
| 351 // fixed. |
| 352 tracked_objects::ScopedTracker tracking_profile( |
| 353 FROM_HERE_WITH_EXPLICIT_FUNCTION("455423 URLRequestJob::NotifyDone")); |
345 // The request failed. | 354 // The request failed. |
346 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 355 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
347 net::ERR_FAILED)); | 356 net::ERR_FAILED)); |
348 } | 357 } |
349 } | 358 } |
350 | 359 |
351 bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size, | 360 bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size, |
352 int* bytes_read) { | 361 int* bytes_read) { |
353 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. | 362 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. |
354 tracked_objects::ScopedTracker tracking_profile( | 363 tracked_objects::ScopedTracker tracking_profile( |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 i != pending_requests_.end(); ++i) { | 718 i != pending_requests_.end(); ++i) { |
710 if (i->second == job) { | 719 if (i->second == job) { |
711 pending_requests_.erase(i); | 720 pending_requests_.erase(i); |
712 return; | 721 return; |
713 } | 722 } |
714 } | 723 } |
715 } | 724 } |
716 | 725 |
717 void URLDataManagerBackend::DataAvailable(RequestID request_id, | 726 void URLDataManagerBackend::DataAvailable(RequestID request_id, |
718 base::RefCountedMemory* bytes) { | 727 base::RefCountedMemory* bytes) { |
| 728 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455423 is fixed. |
| 729 tracked_objects::ScopedTracker tracking_profile( |
| 730 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 731 "455423 URLDataManagerBackend::DataAvailable")); |
719 // Forward this data on to the pending net::URLRequest, if it exists. | 732 // Forward this data on to the pending net::URLRequest, if it exists. |
720 PendingRequestMap::iterator i = pending_requests_.find(request_id); | 733 PendingRequestMap::iterator i = pending_requests_.find(request_id); |
721 if (i != pending_requests_.end()) { | 734 if (i != pending_requests_.end()) { |
722 URLRequestChromeJob* job(i->second); | 735 URLRequestChromeJob* job = i->second; |
723 pending_requests_.erase(i); | 736 pending_requests_.erase(i); |
724 job->DataAvailable(bytes); | 737 job->DataAvailable(bytes); |
725 } | 738 } |
726 } | 739 } |
727 | 740 |
728 namespace { | 741 namespace { |
729 | 742 |
730 class DevToolsJobFactory | 743 class DevToolsJobFactory |
731 : public net::URLRequestJobFactory::ProtocolHandler { | 744 : public net::URLRequestJobFactory::ProtocolHandler { |
732 public: | 745 public: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 783 |
771 } // namespace | 784 } // namespace |
772 | 785 |
773 net::URLRequestJobFactory::ProtocolHandler* | 786 net::URLRequestJobFactory::ProtocolHandler* |
774 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 787 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
775 bool is_incognito) { | 788 bool is_incognito) { |
776 return new DevToolsJobFactory(resource_context, is_incognito); | 789 return new DevToolsJobFactory(resource_context, is_incognito); |
777 } | 790 } |
778 | 791 |
779 } // namespace content | 792 } // namespace content |
OLD | NEW |