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_CHILD_URL_LOADER_CLIENT_IMPL_H_ | 5 #ifndef CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_ |
6 #define CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_ | 6 #define CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "content/common/url_loader.mojom.h" | 14 #include "content/common/url_loader.mojom.h" |
15 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
16 #include "mojo/public/cpp/bindings/associated_binding.h" | 16 #include "mojo/public/cpp/bindings/associated_binding.h" |
17 #include "mojo/public/cpp/system/data_pipe.h" | 17 #include "mojo/public/cpp/system/data_pipe.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
21 } // namespace base | 21 } // namespace base |
22 | 22 |
23 namespace mojo { | |
24 class AssociatedGroup; | |
25 } // namespace mojo | |
26 | |
27 namespace net { | 23 namespace net { |
28 struct RedirectInfo; | 24 struct RedirectInfo; |
29 } // namespace net | 25 } // namespace net |
30 | 26 |
31 namespace content { | 27 namespace content { |
32 class ResourceDispatcher; | 28 class ResourceDispatcher; |
33 class URLResponseBodyConsumer; | 29 class URLResponseBodyConsumer; |
34 struct ResourceRequestCompletionStatus; | 30 struct ResourceRequestCompletionStatus; |
35 struct ResourceResponseHead; | 31 struct ResourceResponseHead; |
36 | 32 |
37 class CONTENT_EXPORT URLLoaderClientImpl final : public mojom::URLLoaderClient { | 33 class CONTENT_EXPORT URLLoaderClientImpl final : public mojom::URLLoaderClient { |
38 public: | 34 public: |
39 URLLoaderClientImpl(int request_id, | 35 URLLoaderClientImpl(int request_id, |
40 ResourceDispatcher* resource_dispatcher, | 36 ResourceDispatcher* resource_dispatcher, |
41 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 37 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
42 ~URLLoaderClientImpl() override; | 38 ~URLLoaderClientImpl() override; |
43 | 39 |
44 void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info, | 40 void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info); |
45 mojo::AssociatedGroup* associated_group); | |
46 | 41 |
47 // Sets |is_deferred_|. From now, the received messages are not dispatched | 42 // Sets |is_deferred_|. From now, the received messages are not dispatched |
48 // to clients until UnsetDefersLoading is called. | 43 // to clients until UnsetDefersLoading is called. |
49 void SetDefersLoading(); | 44 void SetDefersLoading(); |
50 | 45 |
51 // Unsets |is_deferred_|. | 46 // Unsets |is_deferred_|. |
52 void UnsetDefersLoading(); | 47 void UnsetDefersLoading(); |
53 | 48 |
54 // Disaptches the messages received after SetDefersLoading is called. | 49 // Disaptches the messages received after SetDefersLoading is called. |
55 void FlushDeferredMessages(); | 50 void FlushDeferredMessages(); |
(...skipping 26 matching lines...) Expand all Loading... |
82 bool is_deferred_ = false; | 77 bool is_deferred_ = false; |
83 int32_t accumulated_transfer_size_diff_during_deferred_ = 0; | 78 int32_t accumulated_transfer_size_diff_during_deferred_ = 0; |
84 ResourceDispatcher* const resource_dispatcher_; | 79 ResourceDispatcher* const resource_dispatcher_; |
85 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 80 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
86 base::WeakPtrFactory<URLLoaderClientImpl> weak_factory_; | 81 base::WeakPtrFactory<URLLoaderClientImpl> weak_factory_; |
87 }; | 82 }; |
88 | 83 |
89 } // namespace content | 84 } // namespace content |
90 | 85 |
91 #endif // CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_ | 86 #endif // CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_ |
OLD | NEW |