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

Unified Diff: content/browser/loader/navigation_resource_handler.h

Issue 2797443005: PlzNavigate data pipe
Patch Set: cleanup Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/navigation_resource_handler.h
diff --git a/content/browser/loader/navigation_resource_handler.h b/content/browser/loader/navigation_resource_handler.h
index c605e62c3ebc478180414dd6c4d021cb045eb8cf..af1db87310ca380c717ee7d73d1c71feca46e520 100644
--- a/content/browser/loader/navigation_resource_handler.h
+++ b/content/browser/loader/navigation_resource_handler.h
@@ -9,10 +9,12 @@
#include "base/macros.h"
#include "content/browser/loader/resource_handler.h"
-#include "content/browser/loader/stream_writer.h"
+#include "mojo/public/cpp/system/data_pipe.h"
+#include "mojo/public/cpp/system/simple_watcher.h"
namespace net {
class SSLInfo;
+class IOBufferWithSize;
}
namespace content {
@@ -65,14 +67,42 @@ class NavigationResourceHandler : public ResourceHandler {
void OnDataDownloaded(int bytes_downloaded) override;
private:
+ class SharedWriter;
+ class WriterIOBuffer;
+
// Clears |core_| and its reference to the resource handler. After calling
// this, the lifetime of the request is no longer tied to |core_|.
void DetachFromCore();
+ void InitializeDataPipe(mojo::ScopedDataPipeConsumerHandle* consumer_handle);
+ virtual MojoResult BeginWrite(void** data, uint32_t* available);
+ virtual MojoResult EndWrite(uint32_t written);
+ bool CopyReadDataToDataPipe(bool* defer);
+ bool AllocateWriterIOBuffer(scoped_refptr<net::IOBufferWithSize>* buf,
+ bool* defer);
+ void OnWritable(MojoResult result);
+
NavigationURLLoaderImplCore* core_;
- StreamWriter writer_;
ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_;
+ bool is_using_io_buffer_not_from_writer_ = false;
+
+ // True if OnWillRead was deferred, in order to wait to be able to allocate a
+ // buffer.
+ bool did_defer_on_will_read_ = false;
+ bool did_defer_on_writing_ = false;
+ bool did_defer_on_redirect_ = false;
+
+ scoped_refptr<net::IOBuffer>* parent_buffer_ = nullptr;
+ int* parent_buffer_size_ = nullptr;
+
+ mojo::SimpleWatcher handle_watcher_;
+ scoped_refptr<net::IOBufferWithSize> buffer_;
+ size_t buffer_offset_ = 0;
+ size_t buffer_bytes_read_ = 0;
+ scoped_refptr<SharedWriter> shared_writer_;
+ bool first_read_ = true;
+
DISALLOW_COPY_AND_ASSIGN(NavigationResourceHandler);
};
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/loader/navigation_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698