Chromium Code Reviews| Index: content/browser/loader/mojo_async_resource_handler.h |
| diff --git a/content/browser/loader/async_resource_handler.h b/content/browser/loader/mojo_async_resource_handler.h |
| similarity index 51% |
| copy from content/browser/loader/async_resource_handler.h |
| copy to content/browser/loader/mojo_async_resource_handler.h |
| index 0991021336043dc8b4d990a24352ca6408aaa22d..58f84a3a90ed9d235cdea6f2a13f62223ddfe05f 100644 |
| --- a/content/browser/loader/async_resource_handler.h |
| +++ b/content/browser/loader/mojo_async_resource_handler.h |
| @@ -1,19 +1,22 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| -#define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| +#ifndef CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| +#define CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| #include <stdint.h> |
| +#include <memory> |
| #include <string> |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/timer/timer.h" |
| #include "content/browser/loader/resource_handler.h" |
| -#include "content/browser/loader/resource_message_delegate.h" |
| +#include "content/common/url_loader.mojom.h" |
| +#include "mojo/message_pump/handle_watcher.h" |
| +#include "mojo/public/cpp/system/data_pipe.h" |
| #include "net/base/io_buffer.h" |
| #include "url/gurl.h" |
| @@ -22,22 +25,17 @@ class URLRequest; |
| } |
| namespace content { |
| -class ResourceBuffer; |
| -class ResourceContext; |
| class ResourceDispatcherHostImpl; |
| -class ResourceMessageFilter; |
| -class SharedIOBuffer; |
| // Used to complete an asynchronous resource request in response to resource |
| // load events from the resource dispatcher host. |
|
kinuko
2016/05/26 08:43:12
nit: add a comment to note that this is used only
yhirano
2016/05/26 15:42:44
Done.
|
| -class AsyncResourceHandler : public ResourceHandler, |
| - public ResourceMessageDelegate { |
| +class MojoAsyncResourceHandler : public ResourceHandler { |
| public: |
| - AsyncResourceHandler(net::URLRequest* request, |
| - ResourceDispatcherHostImpl* rdh); |
| - ~AsyncResourceHandler() override; |
| - |
| - bool OnMessageReceived(const IPC::Message& message) override; |
| + MojoAsyncResourceHandler(net::URLRequest* request, |
| + ResourceDispatcherHostImpl* rdh, |
| + std::unique_ptr<mojom::URLLoader> url_loader, |
| + mojom::URLLoaderClientPtr url_loader_client); |
| + ~MojoAsyncResourceHandler() override; |
| // ResourceHandler implementation: |
| bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
| @@ -56,50 +54,30 @@ class AsyncResourceHandler : public ResourceHandler, |
| void OnDataDownloaded(int bytes_downloaded) override; |
| private: |
| - class InliningHelper; |
| - |
| // IPC message handlers: |
| void OnFollowRedirect(int request_id); |
| - void OnDataReceivedACK(int request_id); |
| - void OnUploadProgressACK(int request_id); |
| - void ReportUploadProgress(); |
| - |
| - bool EnsureResourceBufferIsInitialized(); |
| void ResumeIfDeferred(); |
| void OnDefer(); |
| bool CheckForSufficientResource(); |
| - int CalculateEncodedDataLengthToReport(); |
| void RecordHistogram(); |
| + void OnWritable(MojoResult result); |
| - scoped_refptr<ResourceBuffer> buffer_; |
| ResourceDispatcherHostImpl* rdh_; |
| - // Number of messages we've sent to the renderer that we haven't gotten an |
| - // ACK for. This allows us to avoid having too many messages in flight. |
| - int pending_data_count_; |
| - |
| - int allocation_size_; |
| - |
| - bool did_defer_; |
| - |
| - bool has_checked_for_sufficient_resources_; |
| - bool sent_received_response_msg_; |
| - bool sent_data_buffer_msg_; |
| - |
| - std::unique_ptr<InliningHelper> inlining_helper_; |
| + bool did_defer_ = false; |
| + bool has_checked_for_sufficient_resources_ = false; |
| + bool sent_received_response_message_ = false; |
| base::TimeTicks response_started_ticks_; |
| - uint64_t last_upload_position_; |
| - bool waiting_for_upload_progress_ack_; |
| - base::TimeTicks last_upload_ticks_; |
| - base::RepeatingTimer progress_timer_; |
| - |
| - int64_t reported_transfer_size_; |
| + mojo::ScopedDataPipeProducerHandle writer_; |
| + mojo::common::HandleWatcher handle_watcher_; |
| + std::unique_ptr<mojom::URLLoader> url_loader_; |
| + mojom::URLLoaderClientPtr url_loader_client_; |
| - DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
| + DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); |
| }; |
| } // namespace content |
| -#endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
| +#endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |