| 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 #ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ResourceDispatcherHostImpl; | 21 class ResourceDispatcherHostImpl; |
| 22 class ResourceMessageFilter; | 22 class ResourceMessageFilter; |
| 23 class SharedIOBuffer; | 23 class SharedIOBuffer; |
| 24 | 24 |
| 25 // Used to complete an asynchronous resource request in response to resource | 25 // Used to complete an asynchronous resource request in response to resource |
| 26 // load events from the resource dispatcher host. | 26 // load events from the resource dispatcher host. |
| 27 class AsyncResourceHandler : public ResourceHandler, | 27 class AsyncResourceHandler : public ResourceHandler, |
| 28 public ResourceMessageDelegate { | 28 public ResourceMessageDelegate { |
| 29 public: | 29 public: |
| 30 AsyncResourceHandler(ResourceMessageFilter* filter, | 30 AsyncResourceHandler(ResourceMessageFilter* filter, |
| 31 int routing_id, | |
| 32 net::URLRequest* request, | 31 net::URLRequest* request, |
| 33 ResourceDispatcherHostImpl* rdh); | 32 ResourceDispatcherHostImpl* rdh); |
| 34 virtual ~AsyncResourceHandler(); | 33 virtual ~AsyncResourceHandler(); |
| 35 | 34 |
| 36 virtual bool OnMessageReceived(const IPC::Message& message, | 35 virtual bool OnMessageReceived(const IPC::Message& message, |
| 37 bool* message_was_ok) OVERRIDE; | 36 bool* message_was_ok) OVERRIDE; |
| 38 | 37 |
| 39 // ResourceHandler implementation: | 38 // ResourceHandler implementation: |
| 40 virtual bool OnUploadProgress(int request_id, | 39 virtual bool OnUploadProgress(int request_id, |
| 41 uint64 position, | 40 uint64 position, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 68 void OnFollowRedirect(int request_id, | 67 void OnFollowRedirect(int request_id, |
| 69 bool has_new_first_party_for_cookies, | 68 bool has_new_first_party_for_cookies, |
| 70 const GURL& new_first_party_for_cookies); | 69 const GURL& new_first_party_for_cookies); |
| 71 void OnDataReceivedACK(int request_id); | 70 void OnDataReceivedACK(int request_id); |
| 72 | 71 |
| 73 bool EnsureResourceBufferIsInitialized(); | 72 bool EnsureResourceBufferIsInitialized(); |
| 74 void ResumeIfDeferred(); | 73 void ResumeIfDeferred(); |
| 75 | 74 |
| 76 scoped_refptr<ResourceBuffer> buffer_; | 75 scoped_refptr<ResourceBuffer> buffer_; |
| 77 scoped_refptr<ResourceMessageFilter> filter_; | 76 scoped_refptr<ResourceMessageFilter> filter_; |
| 78 int routing_id_; | |
| 79 net::URLRequest* request_; | 77 net::URLRequest* request_; |
| 80 ResourceDispatcherHostImpl* rdh_; | 78 ResourceDispatcherHostImpl* rdh_; |
| 81 | 79 |
| 82 // Number of messages we've sent to the renderer that we haven't gotten an | 80 // Number of messages we've sent to the renderer that we haven't gotten an |
| 83 // ACK for. This allows us to avoid having too many messages in flight. | 81 // ACK for. This allows us to avoid having too many messages in flight. |
| 84 int pending_data_count_; | 82 int pending_data_count_; |
| 85 | 83 |
| 86 int allocation_size_; | 84 int allocation_size_; |
| 87 | 85 |
| 88 bool did_defer_; | 86 bool did_defer_; |
| 89 | 87 |
| 90 bool has_checked_for_sufficient_resources_; | 88 bool has_checked_for_sufficient_resources_; |
| 91 bool sent_received_response_msg_; | 89 bool sent_received_response_msg_; |
| 92 bool sent_first_data_msg_; | 90 bool sent_first_data_msg_; |
| 93 | 91 |
| 94 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 92 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
| 95 }; | 93 }; |
| 96 | 94 |
| 97 } // namespace content | 95 } // namespace content |
| 98 | 96 |
| 99 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 97 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |