Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: content/browser/loader/mojo_async_resource_handler.h

Issue 2738973002: Allow MojoAsyncResourceHandler::OnWillRead to complete asyncronously (Closed)
Patch Set: Merge Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 mojom::URLLoaderClientPtr url_loader_client); 125 mojom::URLLoaderClientPtr url_loader_client);
126 void SendUploadProgress(const net::UploadProgress& progress); 126 void SendUploadProgress(const net::UploadProgress& progress);
127 void OnUploadProgressACK(); 127 void OnUploadProgressACK();
128 128
129 ResourceDispatcherHostImpl* rdh_; 129 ResourceDispatcherHostImpl* rdh_;
130 mojo::AssociatedBinding<mojom::URLLoader> binding_; 130 mojo::AssociatedBinding<mojom::URLLoader> binding_;
131 131
132 bool has_checked_for_sufficient_resources_ = false; 132 bool has_checked_for_sufficient_resources_ = false;
133 bool sent_received_response_message_ = false; 133 bool sent_received_response_message_ = false;
134 bool is_using_io_buffer_not_from_writer_ = false; 134 bool is_using_io_buffer_not_from_writer_ = false;
135 // True if OnWillRead was deferred, in order to wait to be able to allocate a
136 // buffer.
137 bool did_defer_on_will_read_ = false;
135 bool did_defer_on_writing_ = false; 138 bool did_defer_on_writing_ = false;
136 bool did_defer_on_redirect_ = false; 139 bool did_defer_on_redirect_ = false;
137 base::TimeTicks response_started_ticks_; 140 base::TimeTicks response_started_ticks_;
138 int64_t reported_total_received_bytes_ = 0; 141 int64_t reported_total_received_bytes_ = 0;
139 142
143 // Pointer to parent's information about the read buffer. Only non-null while
144 // OnWillRead is deferred.
145 scoped_refptr<net::IOBuffer>* parent_buffer_ = nullptr;
146 int* parent_buffer_size_ = nullptr;
147
140 mojo::SimpleWatcher handle_watcher_; 148 mojo::SimpleWatcher handle_watcher_;
141 std::unique_ptr<mojom::URLLoader> url_loader_; 149 std::unique_ptr<mojom::URLLoader> url_loader_;
142 mojom::URLLoaderClientPtr url_loader_client_; 150 mojom::URLLoaderClientPtr url_loader_client_;
143 scoped_refptr<net::IOBufferWithSize> buffer_; 151 scoped_refptr<net::IOBufferWithSize> buffer_;
144 size_t buffer_offset_ = 0; 152 size_t buffer_offset_ = 0;
145 size_t buffer_bytes_read_ = 0; 153 size_t buffer_bytes_read_ = 0;
146 scoped_refptr<SharedWriter> shared_writer_; 154 scoped_refptr<SharedWriter> shared_writer_;
147 mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_; 155 mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_;
148 156
149 std::unique_ptr<UploadProgressTracker> upload_progress_tracker_; 157 std::unique_ptr<UploadProgressTracker> upload_progress_tracker_;
150 158
151 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; 159 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_;
152 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); 160 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler);
153 }; 161 };
154 162
155 } // namespace content 163 } // namespace content
156 164
157 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ 165 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/mock_resource_loader.cc ('k') | content/browser/loader/mojo_async_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698