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

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 1220943003: [Background Sync] Use Mojo IPC to fire background sync events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mek
Patch Set: Add connection error handler; make type converter safer. Created 5 years, 5 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
OLDNEW
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 <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/id_map.h" 17 #include "base/id_map.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "base/timer/timer.h" 21 #include "base/timer/timer.h"
22 #include "content/browser/service_worker/embedded_worker_instance.h" 22 #include "content/browser/service_worker/embedded_worker_instance.h"
23 #include "content/browser/service_worker/service_worker_script_cache_map.h" 23 #include "content/browser/service_worker/service_worker_script_cache_map.h"
24 #include "content/common/background_sync_service.mojom.h"
24 #include "content/common/content_export.h" 25 #include "content/common/content_export.h"
25 #include "content/common/service_port_service.mojom.h" 26 #include "content/common/service_port_service.mojom.h"
26 #include "content/common/service_worker/service_worker_status_code.h" 27 #include "content/common/service_worker/service_worker_status_code.h"
27 #include "content/common/service_worker/service_worker_types.h" 28 #include "content/common/service_worker/service_worker_types.h"
28 #include "content/public/common/service_registry.h" 29 #include "content/public/common/service_registry.h"
29 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" 30 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h"
30 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" 31 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h"
31 32
32 // Windows headers will redefine SendMessage. 33 // Windows headers will redefine SendMessage.
33 #ifdef SendMessage 34 #ifdef SendMessage
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 void OnGetClients(int request_id, 432 void OnGetClients(int request_id,
432 const ServiceWorkerClientQueryOptions& options); 433 const ServiceWorkerClientQueryOptions& options);
433 434
434 void OnActivateEventFinished(int request_id, 435 void OnActivateEventFinished(int request_id,
435 blink::WebServiceWorkerEventResult result); 436 blink::WebServiceWorkerEventResult result);
436 void OnInstallEventFinished(int request_id, 437 void OnInstallEventFinished(int request_id,
437 blink::WebServiceWorkerEventResult result); 438 blink::WebServiceWorkerEventResult result);
438 void OnFetchEventFinished(int request_id, 439 void OnFetchEventFinished(int request_id,
439 ServiceWorkerFetchEventResult result, 440 ServiceWorkerFetchEventResult result,
440 const ServiceWorkerResponse& response); 441 const ServiceWorkerResponse& response);
441 void OnSyncEventFinished(int request_id, 442 void OnSyncEventFinished(int request_id, ServiceWorkerEventStatus status);
442 blink::WebServiceWorkerEventResult result);
443 void OnNotificationClickEventFinished(int request_id); 443 void OnNotificationClickEventFinished(int request_id);
444 void OnPushEventFinished(int request_id, 444 void OnPushEventFinished(int request_id,
445 blink::WebServiceWorkerEventResult result); 445 blink::WebServiceWorkerEventResult result);
446 void OnGeofencingEventFinished(int request_id); 446 void OnGeofencingEventFinished(int request_id);
447 void OnServicePortConnectEventFinished(int request_id, 447 void OnServicePortConnectEventFinished(int request_id,
448 ServicePortConnectResult result, 448 ServicePortConnectResult result,
449 const mojo::String& name, 449 const mojo::String& name,
450 const mojo::String& data); 450 const mojo::String& data);
451 void OnOpenWindow(int request_id, GURL url); 451 void OnOpenWindow(int request_id, GURL url);
452 void DidOpenWindow(int request_id, 452 void DidOpenWindow(int request_id,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // Sets |stale_time_| if this worker is stale, causing an update to eventually 534 // Sets |stale_time_| if this worker is stale, causing an update to eventually
535 // occur once the worker stops or is running too long. 535 // occur once the worker stops or is running too long.
536 void MarkIfStale(); 536 void MarkIfStale();
537 537
538 void FoundRegistrationForUpdate( 538 void FoundRegistrationForUpdate(
539 ServiceWorkerStatusCode status, 539 ServiceWorkerStatusCode status,
540 const scoped_refptr<ServiceWorkerRegistration>& registration); 540 const scoped_refptr<ServiceWorkerRegistration>& registration);
541 541
542 void OnStoppedInternal(EmbeddedWorkerInstance::Status old_status); 542 void OnStoppedInternal(EmbeddedWorkerInstance::Status old_status);
543 543
544 // Called when the connection to a ServicePortDispatcher drops or fails. 544 // Called when a connection to a mojo event Dispatcher drops or fails.
545 // Calls callbacks for any outstanding requests to the dispatcher as well 545 // Calls callbacks for any outstanding requests to the dispatcher as well
546 // as cleans up the dispatcher. 546 // as cleans up the dispatcher.
547 void OnServicePortDispatcherConnectionError(); 547 void OnServicePortDispatcherConnectionError();
548 void OnBackgroundSyncDispatcherConnectionError();
548 549
549 const int64 version_id_; 550 const int64 version_id_;
550 const int64 registration_id_; 551 const int64 registration_id_;
551 const GURL script_url_; 552 const GURL script_url_;
552 const GURL scope_; 553 const GURL scope_;
553 554
554 Status status_ = NEW; 555 Status status_ = NEW;
555 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; 556 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_;
556 std::vector<StatusCallback> start_callbacks_; 557 std::vector<StatusCallback> start_callbacks_;
557 std::vector<StatusCallback> stop_callbacks_; 558 std::vector<StatusCallback> stop_callbacks_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 611
611 // The status when StartWorker was invoked. Used for UMA. 612 // The status when StartWorker was invoked. Used for UMA.
612 Status prestart_status_ = NEW; 613 Status prestart_status_ = NEW;
613 // If not OK, the reason that StartWorker failed. Used for 614 // If not OK, the reason that StartWorker failed. Used for
614 // running |start_callbacks_|. 615 // running |start_callbacks_|.
615 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK; 616 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK;
616 617
617 scoped_ptr<PingController> ping_controller_; 618 scoped_ptr<PingController> ping_controller_;
618 scoped_ptr<Metrics> metrics_; 619 scoped_ptr<Metrics> metrics_;
619 620
621 BackgroundSyncServiceClientPtr background_sync_dispatcher_;
Marijn Kruisselbrink 2015/07/20 16:16:19 Maybe keep the declaration of the various mojo ser
iclelland 2015/07/20 18:05:20 Definitely. Done.
622
620 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 623 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
621 624
622 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 625 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
623 }; 626 };
624 627
625 } // namespace content 628 } // namespace content
626 629
627 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 630 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698