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

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

Issue 2629513003: Implement CachedMetadata handling on MojoAsyncResourceHandler (Closed)
Patch Set: fix Created 3 years, 11 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
« no previous file with comments | « no previous file | content/browser/loader/mojo_async_resource_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "content/browser/loader/resource_handler.h" 17 #include "content/browser/loader/resource_handler.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/common/url_loader.mojom.h" 19 #include "content/common/url_loader.mojom.h"
20 #include "mojo/public/cpp/bindings/associated_binding.h" 20 #include "mojo/public/cpp/bindings/associated_binding.h"
21 #include "mojo/public/cpp/system/watcher.h" 21 #include "mojo/public/cpp/system/watcher.h"
22 #include "net/base/io_buffer.h" 22 #include "net/base/io_buffer.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 namespace net { 25 namespace net {
26 class IOBufferWithSize;
26 class URLRequest; 27 class URLRequest;
27 } 28 }
28 29
29 namespace content { 30 namespace content {
30 class ResourceDispatcherHostImpl; 31 class ResourceDispatcherHostImpl;
31 struct ResourceResponse; 32 struct ResourceResponse;
32 33
33 // Used to complete an asynchronous resource request in response to resource 34 // Used to complete an asynchronous resource request in response to resource
34 // load events from the resource dispatcher host. This class is used only 35 // load events from the resource dispatcher host. This class is used only
35 // when LoadingWithMojo runtime flag is enabled. 36 // when LoadingWithMojo runtime flag is enabled.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void FollowRedirect() override; 68 void FollowRedirect() override;
68 69
69 void OnWritableForTesting(); 70 void OnWritableForTesting();
70 static void SetAllocationSizeForTesting(size_t size); 71 static void SetAllocationSizeForTesting(size_t size);
71 static constexpr size_t kDefaultAllocationSize = 512 * 1024; 72 static constexpr size_t kDefaultAllocationSize = 512 * 1024;
72 73
73 protected: 74 protected:
74 // These functions can be overriden only for tests. 75 // These functions can be overriden only for tests.
75 virtual MojoResult BeginWrite(void** data, uint32_t* available); 76 virtual MojoResult BeginWrite(void** data, uint32_t* available);
76 virtual MojoResult EndWrite(uint32_t written); 77 virtual MojoResult EndWrite(uint32_t written);
78 virtual net::IOBufferWithSize* GetResponseMetadata(net::URLRequest* request);
77 79
78 private: 80 private:
79 class SharedWriter; 81 class SharedWriter;
80 class WriterIOBuffer; 82 class WriterIOBuffer;
81 83
82 // This funcion copies data stored in |buffer_| to |shared_writer_| and 84 // This funcion copies data stored in |buffer_| to |shared_writer_| and
83 // resets |buffer_| to a WriterIOBuffer when all bytes are copied. Returns 85 // resets |buffer_| to a WriterIOBuffer when all bytes are copied. Returns
84 // true when done successfully. 86 // true when done successfully.
85 bool CopyReadDataToDataPipe(bool* defer); 87 bool CopyReadDataToDataPipe(bool* defer);
86 // Allocates a WriterIOBuffer and set it to |*buf|. Returns true when done 88 // Allocates a WriterIOBuffer and set it to |*buf|. Returns true when done
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 size_t buffer_bytes_read_ = 0; 122 size_t buffer_bytes_read_ = 0;
121 scoped_refptr<SharedWriter> shared_writer_; 123 scoped_refptr<SharedWriter> shared_writer_;
122 124
123 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; 125 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_;
124 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); 126 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler);
125 }; 127 };
126 128
127 } // namespace content 129 } // namespace content
128 130
129 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ 131 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/mojo_async_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698