| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 void OnStoppedInternal(EmbeddedWorkerInstance::Status old_status); | 596 void OnStoppedInternal(EmbeddedWorkerInstance::Status old_status); |
| 597 | 597 |
| 598 // Called when the remote side of a connection to a mojo service is lost. | 598 // Called when the remote side of a connection to a mojo service is lost. |
| 599 void OnMojoConnectionError(const char* service_name); | 599 void OnMojoConnectionError(const char* service_name); |
| 600 | 600 |
| 601 // Called at the beginning of each Dispatch*Event function: records | 601 // Called at the beginning of each Dispatch*Event function: records |
| 602 // the time elapsed since idle (generally the time since the previous | 602 // the time elapsed since idle (generally the time since the previous |
| 603 // event ended). | 603 // event ended). |
| 604 void OnBeginEvent(); | 604 void OnBeginEvent(); |
| 605 | 605 |
| 606 // Resets |start_worker_first_purpose_| and fires and clears all start |
| 607 // callbacks. |
| 608 void RunStartCallbacks(ServiceWorkerStatusCode status); |
| 609 |
| 606 const int64_t version_id_; | 610 const int64_t version_id_; |
| 607 const int64_t registration_id_; | 611 const int64_t registration_id_; |
| 608 const GURL script_url_; | 612 const GURL script_url_; |
| 609 const GURL scope_; | 613 const GURL scope_; |
| 610 std::vector<GURL> foreign_fetch_scopes_; | 614 std::vector<GURL> foreign_fetch_scopes_; |
| 611 std::vector<url::Origin> foreign_fetch_origins_; | 615 std::vector<url::Origin> foreign_fetch_origins_; |
| 612 bool has_fetch_handler_ = true; | 616 bool has_fetch_handler_ = true; |
| 613 | 617 |
| 614 Status status_ = NEW; | 618 Status status_ = NEW; |
| 615 std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_; | 619 std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // If not OK, the reason that StartWorker failed. Used for | 676 // If not OK, the reason that StartWorker failed. Used for |
| 673 // running |start_callbacks_|. | 677 // running |start_callbacks_|. |
| 674 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK; | 678 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK; |
| 675 | 679 |
| 676 std::unique_ptr<PingController> ping_controller_; | 680 std::unique_ptr<PingController> ping_controller_; |
| 677 std::unique_ptr<Metrics> metrics_; | 681 std::unique_ptr<Metrics> metrics_; |
| 678 const bool should_exclude_from_uma_ = false; | 682 const bool should_exclude_from_uma_ = false; |
| 679 | 683 |
| 680 bool stop_when_devtools_detached_ = false; | 684 bool stop_when_devtools_detached_ = false; |
| 681 | 685 |
| 686 // It is used to keep the first purpose of starting the worker for UMA. |
| 687 // Cleared when |start_callbacks_| are executed in RunStartCallbacks(). |
| 688 std::unique_ptr<ServiceWorkerMetrics::EventType> start_worker_first_purpose_; |
| 689 |
| 682 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 690 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 683 | 691 |
| 684 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 692 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 685 }; | 693 }; |
| 686 | 694 |
| 687 template <typename Interface> | 695 template <typename Interface> |
| 688 base::WeakPtr<Interface> ServiceWorkerVersion::GetMojoServiceForRequest( | 696 base::WeakPtr<Interface> ServiceWorkerVersion::GetMojoServiceForRequest( |
| 689 int request_id) { | 697 int request_id) { |
| 690 DCHECK_EQ(RUNNING, running_status()); | 698 DCHECK_EQ(RUNNING, running_status()); |
| 691 PendingRequest<StatusCallback>* request = custom_requests_.Lookup(request_id); | 699 PendingRequest<StatusCallback>* request = custom_requests_.Lookup(request_id); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 766 |
| 759 // At this point |this| can have been deleted, so don't do anything other | 767 // At this point |this| can have been deleted, so don't do anything other |
| 760 // than returning. | 768 // than returning. |
| 761 | 769 |
| 762 return true; | 770 return true; |
| 763 } | 771 } |
| 764 | 772 |
| 765 } // namespace content | 773 } // namespace content |
| 766 | 774 |
| 767 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 775 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |