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_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 // methods always return a rejected promise. And FetchEvent's | 459 // methods always return a rejected promise. And FetchEvent's |
460 // preloadResponse attribute returns a promise which always resolve with | 460 // preloadResponse attribute returns a promise which always resolve with |
461 // undefined. | 461 // undefined. |
462 // - C: Navigation Preload related methods and attributes are not available | 462 // - C: Navigation Preload related methods and attributes are not available |
463 // in JS. | 463 // in JS. |
464 // This method returns SUPPORTED only for A case. | 464 // This method returns SUPPORTED only for A case. |
465 // blink::OriginTrials::serviceWorkerNavigationPreloadEnabled() returns true | 465 // blink::OriginTrials::serviceWorkerNavigationPreloadEnabled() returns true |
466 // for both A and B case. So the methods and attributes are available in JS. | 466 // for both A and B case. So the methods and attributes are available in JS. |
467 NavigationPreloadSupportStatus GetNavigationPreloadSupportStatus() const; | 467 NavigationPreloadSupportStatus GetNavigationPreloadSupportStatus() const; |
468 | 468 |
469 void CountFeature(uint32_t feature); | |
470 void set_used_features(std::set<uint32_t> used_features) { | |
471 used_features_ = used_features; | |
472 } | |
473 std::set<uint32_t> used_features() const { return used_features_; } | |
474 | |
469 private: | 475 private: |
470 friend class base::RefCounted<ServiceWorkerVersion>; | 476 friend class base::RefCounted<ServiceWorkerVersion>; |
471 friend class ServiceWorkerMetrics; | 477 friend class ServiceWorkerMetrics; |
472 friend class ServiceWorkerReadFromCacheJobTest; | 478 friend class ServiceWorkerReadFromCacheJobTest; |
473 friend class ServiceWorkerStallInStoppingTest; | 479 friend class ServiceWorkerStallInStoppingTest; |
474 friend class ServiceWorkerURLRequestJobTest; | 480 friend class ServiceWorkerURLRequestJobTest; |
475 friend class ServiceWorkerVersionBrowserTest; | 481 friend class ServiceWorkerVersionBrowserTest; |
476 friend class ServiceWorkerVersionTest; | 482 friend class ServiceWorkerVersionTest; |
477 | 483 |
478 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 484 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 // while this service worker is running (i.e., after it starts up until it | 843 // while this service worker is running (i.e., after it starts up until it |
838 // stops). | 844 // stops). |
839 std::unique_ptr<ServiceWorkerMetrics::ScopedEventRecorder> event_recorder_; | 845 std::unique_ptr<ServiceWorkerMetrics::ScopedEventRecorder> event_recorder_; |
840 | 846 |
841 bool stop_when_devtools_detached_ = false; | 847 bool stop_when_devtools_detached_ = false; |
842 | 848 |
843 // Keeps the first purpose of starting the worker for UMA. Cleared in | 849 // Keeps the first purpose of starting the worker for UMA. Cleared in |
844 // FinishStartWorker(). | 850 // FinishStartWorker(). |
845 base::Optional<ServiceWorkerMetrics::EventType> start_worker_first_purpose_; | 851 base::Optional<ServiceWorkerMetrics::EventType> start_worker_first_purpose_; |
846 | 852 |
853 // This is the set of features that this worker has used. The values must be | |
854 // from blink::UseCounter::Feature enum. | |
falken
2017/02/08 05:01:53
Can we mention this is the used features that were
nhiroki
2017/02/09 05:11:32
That's correct. Updated.
| |
855 std::set<uint32_t> used_features_; | |
856 | |
847 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 857 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
848 | 858 |
849 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 859 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
850 }; | 860 }; |
851 | 861 |
852 template <typename ResponseMessage> | 862 template <typename ResponseMessage> |
853 void ServiceWorkerVersion::DispatchSimpleEvent(int request_id, | 863 void ServiceWorkerVersion::DispatchSimpleEvent(int request_id, |
854 const IPC::Message& message) { | 864 const IPC::Message& message) { |
855 RegisterSimpleRequest<ResponseMessage>(request_id); | 865 RegisterSimpleRequest<ResponseMessage>(request_id); |
856 DispatchEvent({request_id}, message); | 866 DispatchEvent({request_id}, message); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 | 905 |
896 // At this point |this| can have been deleted, so don't do anything other | 906 // At this point |this| can have been deleted, so don't do anything other |
897 // than returning. | 907 // than returning. |
898 | 908 |
899 return true; | 909 return true; |
900 } | 910 } |
901 | 911 |
902 } // namespace content | 912 } // namespace content |
903 | 913 |
904 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 914 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |