| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class ResourceDispatcherHostImpl; | 27 class ResourceDispatcherHostImpl; |
| 28 class ResourceMessageFilter; | 28 class ResourceMessageFilter; |
| 29 class SharedIOBuffer; | 29 class SharedIOBuffer; |
| 30 | 30 |
| 31 // Used to complete an asynchronous resource request in response to resource | 31 // Used to complete an asynchronous resource request in response to resource |
| 32 // load events from the resource dispatcher host. | 32 // load events from the resource dispatcher host. |
| 33 class AsyncResourceHandler : public ResourceHandler, | 33 class AsyncResourceHandler : public ResourceHandler, |
| 34 public ResourceMessageDelegate { | 34 public ResourceMessageDelegate { |
| 35 public: | 35 public: |
| 36 AsyncResourceHandler(net::URLRequest* request, | 36 AsyncResourceHandler(net::URLRequest* request, |
| 37 ResourceDispatcherHostImpl* rdh); | 37 ResourceDispatcherHostImpl* rdh, |
| 38 bool using_mojo_data_handle); |
| 38 ~AsyncResourceHandler() override; | 39 ~AsyncResourceHandler() override; |
| 39 | 40 |
| 40 bool OnMessageReceived(const IPC::Message& message) override; | 41 bool OnMessageReceived(const IPC::Message& message) override; |
| 41 | 42 |
| 42 // ResourceHandler implementation: | 43 // ResourceHandler implementation: |
| 43 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 44 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 44 ResourceResponse* response, | 45 ResourceResponse* response, |
| 45 bool* defer) override; | 46 bool* defer) override; |
| 46 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 47 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
| 47 bool OnWillStart(const GURL& url, bool* defer) override; | 48 bool OnWillStart(const GURL& url, bool* defer) override; |
| 48 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override; | 49 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override; |
| 49 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 50 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 50 int* buf_size, | 51 int* buf_size, |
| 51 int min_size) override; | 52 int min_size) override; |
| 52 bool OnReadCompleted(int bytes_read, bool* defer) override; | 53 bool OnReadCompleted(int bytes_read, bool* defer) override; |
| 53 void OnResponseCompleted(const net::URLRequestStatus& status, | 54 void OnResponseCompleted(const net::URLRequestStatus& status, |
| 54 const std::string& security_info, | 55 const std::string& security_info, |
| 55 bool* defer) override; | 56 bool* defer) override; |
| 56 void OnDataDownloaded(int bytes_downloaded) override; | 57 void OnDataDownloaded(int bytes_downloaded) override; |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 class InliningHelper; | 60 class InliningHelper; |
| 61 class MojoHelper; |
| 60 | 62 |
| 61 // IPC message handlers: | 63 // IPC message handlers: |
| 62 void OnFollowRedirect(int request_id); | 64 void OnFollowRedirect(int request_id); |
| 63 void OnDataReceivedACK(int request_id); | 65 void OnDataReceivedACK(int request_id); |
| 64 void OnUploadProgressACK(int request_id); | 66 void OnUploadProgressACK(int request_id); |
| 65 | 67 |
| 66 void ReportUploadProgress(); | 68 void ReportUploadProgress(); |
| 67 | 69 |
| 68 bool EnsureResourceBufferIsInitialized(); | 70 bool EnsureResourceBufferIsInitialized(); |
| 69 void ResumeIfDeferred(); | 71 void ResumeIfDeferred(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 90 std::unique_ptr<InliningHelper> inlining_helper_; | 92 std::unique_ptr<InliningHelper> inlining_helper_; |
| 91 base::TimeTicks response_started_ticks_; | 93 base::TimeTicks response_started_ticks_; |
| 92 | 94 |
| 93 uint64_t last_upload_position_; | 95 uint64_t last_upload_position_; |
| 94 bool waiting_for_upload_progress_ack_; | 96 bool waiting_for_upload_progress_ack_; |
| 95 base::TimeTicks last_upload_ticks_; | 97 base::TimeTicks last_upload_ticks_; |
| 96 base::RepeatingTimer progress_timer_; | 98 base::RepeatingTimer progress_timer_; |
| 97 | 99 |
| 98 int64_t reported_transfer_size_; | 100 int64_t reported_transfer_size_; |
| 99 | 101 |
| 102 std::unique_ptr<MojoHelper> mojo_helper_; |
| 103 |
| 100 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 104 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 } // namespace content | 107 } // namespace content |
| 104 | 108 |
| 105 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 109 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |