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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 // true when done successfully. | 84 // true when done successfully. |
85 bool CopyReadDataToDataPipe(bool* defer); | 85 bool CopyReadDataToDataPipe(bool* defer); |
86 // Allocates a WriterIOBuffer and set it to |*buf|. Returns true when done | 86 // Allocates a WriterIOBuffer and set it to |*buf|. Returns true when done |
87 // successfully. | 87 // successfully. |
88 bool AllocateWriterIOBuffer(scoped_refptr<net::IOBufferWithSize>* buf, | 88 bool AllocateWriterIOBuffer(scoped_refptr<net::IOBufferWithSize>* buf, |
89 bool* defer); | 89 bool* defer); |
90 | 90 |
91 bool CheckForSufficientResource(); | 91 bool CheckForSufficientResource(); |
92 void OnWritable(MojoResult result); | 92 void OnWritable(MojoResult result); |
93 void Cancel(); | 93 void Cancel(); |
94 int64_t CalculateTransferSizeDiff(); | |
mmenke
2016/12/13 20:01:25
Mind adding a description to what this does? Not
yhirano
2016/12/14 16:47:27
Done.
| |
94 // This function can be overriden only for tests. | 95 // This function can be overriden only for tests. |
95 virtual void ReportBadMessage(const std::string& error); | 96 virtual void ReportBadMessage(const std::string& error); |
96 | 97 |
97 void OnTransfer(mojom::URLLoaderAssociatedRequest mojo_request, | 98 void OnTransfer(mojom::URLLoaderAssociatedRequest mojo_request, |
98 mojom::URLLoaderClientAssociatedPtr url_loader_client); | 99 mojom::URLLoaderClientAssociatedPtr url_loader_client); |
99 | 100 |
100 ResourceDispatcherHostImpl* rdh_; | 101 ResourceDispatcherHostImpl* rdh_; |
101 mojo::AssociatedBinding<mojom::URLLoader> binding_; | 102 mojo::AssociatedBinding<mojom::URLLoader> binding_; |
102 | 103 |
103 bool has_checked_for_sufficient_resources_ = false; | 104 bool has_checked_for_sufficient_resources_ = false; |
(...skipping 12 matching lines...) Expand all Loading... | |
116 size_t buffer_bytes_read_ = 0; | 117 size_t buffer_bytes_read_ = 0; |
117 scoped_refptr<SharedWriter> shared_writer_; | 118 scoped_refptr<SharedWriter> shared_writer_; |
118 | 119 |
119 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; | 120 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; |
120 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); | 121 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); |
121 }; | 122 }; |
122 | 123 |
123 } // namespace content | 124 } // namespace content |
124 | 125 |
125 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 126 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |