| 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/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 sent_first_data_msg_(false), | 90 sent_first_data_msg_(false), |
| 91 reported_transfer_size_(0) { | 91 reported_transfer_size_(0) { |
| 92 InitializeResourceBufferConstants(); | 92 InitializeResourceBufferConstants(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 AsyncResourceHandler::~AsyncResourceHandler() { | 95 AsyncResourceHandler::~AsyncResourceHandler() { |
| 96 if (has_checked_for_sufficient_resources_) | 96 if (has_checked_for_sufficient_resources_) |
| 97 rdh_->FinishedWithResourcesForRequest(request()); | 97 rdh_->FinishedWithResourcesForRequest(request()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool AsyncResourceHandler::OnMessageReceived(const IPC::Message& message, | 100 bool AsyncResourceHandler::OnMessageReceived(const IPC::Message& message) { |
| 101 bool* message_was_ok) { | |
| 102 bool handled = true; | 101 bool handled = true; |
| 103 IPC_BEGIN_MESSAGE_MAP_EX(AsyncResourceHandler, message, *message_was_ok) | 102 IPC_BEGIN_MESSAGE_MAP(AsyncResourceHandler, message) |
| 104 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 103 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
| 105 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) | 104 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) |
| 106 IPC_MESSAGE_UNHANDLED(handled = false) | 105 IPC_MESSAGE_UNHANDLED(handled = false) |
| 107 IPC_END_MESSAGE_MAP_EX() | 106 IPC_END_MESSAGE_MAP() |
| 108 return handled; | 107 return handled; |
| 109 } | 108 } |
| 110 | 109 |
| 111 void AsyncResourceHandler::OnFollowRedirect(int request_id) { | 110 void AsyncResourceHandler::OnFollowRedirect(int request_id) { |
| 112 if (!request()->status().is_success()) { | 111 if (!request()->status().is_success()) { |
| 113 DVLOG(1) << "OnFollowRedirect for invalid request"; | 112 DVLOG(1) << "OnFollowRedirect for invalid request"; |
| 114 return; | 113 return; |
| 115 } | 114 } |
| 116 | 115 |
| 117 ResumeIfDeferred(); | 116 ResumeIfDeferred(); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 request()->LogUnblocked(); | 402 request()->LogUnblocked(); |
| 404 controller()->Resume(); | 403 controller()->Resume(); |
| 405 } | 404 } |
| 406 } | 405 } |
| 407 | 406 |
| 408 void AsyncResourceHandler::OnDefer() { | 407 void AsyncResourceHandler::OnDefer() { |
| 409 request()->LogBlockedBy("AsyncResourceHandler"); | 408 request()->LogBlockedBy("AsyncResourceHandler"); |
| 410 } | 409 } |
| 411 | 410 |
| 412 } // namespace content | 411 } // namespace content |
| OLD | NEW |