OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 #include <unordered_map> | 15 #include <unordered_map> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/time/time.h" |
22 #include "content/browser/service_worker/service_worker_registration.h" | 23 #include "content/browser/service_worker/service_worker_registration.h" |
23 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
24 #include "content/common/service_worker/service_worker_provider_host_info.h" | 25 #include "content/common/service_worker/service_worker_provider_host_info.h" |
25 #include "content/common/service_worker/service_worker_types.h" | 26 #include "content/common/service_worker/service_worker_types.h" |
26 #include "content/common/worker_url_loader_factory_provider.mojom.h" | 27 #include "content/common/worker_url_loader_factory_provider.mojom.h" |
27 #include "content/public/common/request_context_frame_type.h" | 28 #include "content/public/common/request_context_frame_type.h" |
28 #include "content/public/common/request_context_type.h" | 29 #include "content/public/common/request_context_type.h" |
29 #include "content/public/common/resource_type.h" | 30 #include "content/public/common/resource_type.h" |
30 | 31 |
31 namespace storage { | 32 namespace storage { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // |process_id|. | 81 // |process_id|. |
81 static std::unique_ptr<ServiceWorkerProviderHost> Create( | 82 static std::unique_ptr<ServiceWorkerProviderHost> Create( |
82 int process_id, | 83 int process_id, |
83 ServiceWorkerProviderHostInfo info, | 84 ServiceWorkerProviderHostInfo info, |
84 base::WeakPtr<ServiceWorkerContextCore> context, | 85 base::WeakPtr<ServiceWorkerContextCore> context, |
85 ServiceWorkerDispatcherHost* dispatcher_host); | 86 ServiceWorkerDispatcherHost* dispatcher_host); |
86 | 87 |
87 virtual ~ServiceWorkerProviderHost(); | 88 virtual ~ServiceWorkerProviderHost(); |
88 | 89 |
89 const std::string& client_uuid() const { return client_uuid_; } | 90 const std::string& client_uuid() const { return client_uuid_; } |
| 91 base::TimeTicks create_time() const { return create_time_; } |
90 int process_id() const { return render_process_id_; } | 92 int process_id() const { return render_process_id_; } |
91 int provider_id() const { return info_.provider_id; } | 93 int provider_id() const { return info_.provider_id; } |
92 int frame_id() const; | 94 int frame_id() const; |
93 int route_id() const { return info_.route_id; } | 95 int route_id() const { return info_.route_id; } |
94 const WebContentsGetter& web_contents_getter() const { | 96 const WebContentsGetter& web_contents_getter() const { |
95 return web_contents_getter_; | 97 return web_contents_getter_; |
96 } | 98 } |
97 | 99 |
98 bool is_parent_frame_secure() const { return info_.is_parent_frame_secure; } | 100 bool is_parent_frame_secure() const { return info_.is_parent_frame_secure; } |
99 | 101 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 // Finalizes cross-site transfers and navigation-initalized hosts. | 361 // Finalizes cross-site transfers and navigation-initalized hosts. |
360 void FinalizeInitialization(int process_id, | 362 void FinalizeInitialization(int process_id, |
361 int frame_routing_id, | 363 int frame_routing_id, |
362 ServiceWorkerDispatcherHost* dispatcher_host); | 364 ServiceWorkerDispatcherHost* dispatcher_host); |
363 | 365 |
364 // Clears the information of the ServiceWorkerWorkerClient of dedicated (or | 366 // Clears the information of the ServiceWorkerWorkerClient of dedicated (or |
365 // shared) worker, when the connection to the worker is disconnected. | 367 // shared) worker, when the connection to the worker is disconnected. |
366 void UnregisterWorkerFetchContext(mojom::ServiceWorkerWorkerClient*); | 368 void UnregisterWorkerFetchContext(mojom::ServiceWorkerWorkerClient*); |
367 | 369 |
368 std::string client_uuid_; | 370 std::string client_uuid_; |
| 371 base::TimeTicks create_time_; |
369 int render_process_id_; | 372 int render_process_id_; |
370 | 373 |
371 // For provider hosts that are hosting a running service worker, the id of the | 374 // For provider hosts that are hosting a running service worker, the id of the |
372 // service worker thread. Otherwise, |kDocumentMainThreadId|. May be | 375 // service worker thread. Otherwise, |kDocumentMainThreadId|. May be |
373 // |kInvalidEmbeddedWorkerThreadId| before the hosted service worker starts | 376 // |kInvalidEmbeddedWorkerThreadId| before the hosted service worker starts |
374 // up, or during cross-site transfers. | 377 // up, or during cross-site transfers. |
375 int render_thread_id_; | 378 int render_thread_id_; |
376 | 379 |
377 // Keeps the basic provider's info provided from the renderer side. | 380 // Keeps the basic provider's info provided from the renderer side. |
378 ServiceWorkerProviderHostInfo info_; | 381 ServiceWorkerProviderHostInfo info_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 std::unordered_map<mojom::ServiceWorkerWorkerClient*, | 413 std::unordered_map<mojom::ServiceWorkerWorkerClient*, |
411 mojom::ServiceWorkerWorkerClientAssociatedPtr> | 414 mojom::ServiceWorkerWorkerClientAssociatedPtr> |
412 worker_clients_; | 415 worker_clients_; |
413 | 416 |
414 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 417 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
415 }; | 418 }; |
416 | 419 |
417 } // namespace content | 420 } // namespace content |
418 | 421 |
419 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 422 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |