| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 62 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 63 int* buf_size, | 63 int* buf_size, |
| 64 int min_size) override; | 64 int min_size) override; |
| 65 bool OnReadCompleted(int bytes_read, bool* defer) override; | 65 bool OnReadCompleted(int bytes_read, bool* defer) override; |
| 66 void OnResponseCompleted(const net::URLRequestStatus& status, | 66 void OnResponseCompleted(const net::URLRequestStatus& status, |
| 67 bool* defer) override; | 67 bool* defer) override; |
| 68 void OnDataDownloaded(int bytes_downloaded) override; | 68 void OnDataDownloaded(int bytes_downloaded) override; |
| 69 | 69 |
| 70 // mojom::URLLoader implementation | 70 // mojom::URLLoader implementation |
| 71 void FollowRedirect() override; | 71 void FollowRedirect() override; |
| 72 void SetPriority(mojom::RequestPriority priority, |
| 73 int32_t intra_priority_value) override; |
| 72 | 74 |
| 73 void OnWritableForTesting(); | 75 void OnWritableForTesting(); |
| 74 static void SetAllocationSizeForTesting(size_t size); | 76 static void SetAllocationSizeForTesting(size_t size); |
| 75 static constexpr size_t kDefaultAllocationSize = 512 * 1024; | 77 static constexpr size_t kDefaultAllocationSize = 512 * 1024; |
| 76 | 78 |
| 77 protected: | 79 protected: |
| 78 // These functions can be overriden only for tests. | 80 // These functions can be overriden only for tests. |
| 79 virtual MojoResult BeginWrite(void** data, uint32_t* available); | 81 virtual MojoResult BeginWrite(void** data, uint32_t* available); |
| 80 virtual MojoResult EndWrite(uint32_t written); | 82 virtual MojoResult EndWrite(uint32_t written); |
| 81 virtual net::IOBufferWithSize* GetResponseMetadata(net::URLRequest* request); | 83 virtual net::IOBufferWithSize* GetResponseMetadata(net::URLRequest* request); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 scoped_refptr<SharedWriter> shared_writer_; | 128 scoped_refptr<SharedWriter> shared_writer_; |
| 127 mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_; | 129 mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_; |
| 128 | 130 |
| 129 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; | 131 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; |
| 130 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); | 132 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 } // namespace content | 135 } // namespace content |
| 134 | 136 |
| 135 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 137 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |