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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h

Issue 2517223002: Move content/renderer/background_sync to Blink (Closed)
Patch Set: Fix broken WebEmbeddedWorker test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h
index 03d806ca926ca46c675939ae6de4eec3dee427b8..f35ceb48309405059eb8dc970506d4dad59e21b5 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h
+++ b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h
@@ -9,7 +9,9 @@
#include "modules/ModulesExport.h"
#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
#include "platform/Timer.h"
+#include "public/platform/modules/serviceworker/service_worker_event_status.mojom-shared.h"
#include "wtf/Forward.h"
+#include <memory>
namespace blink {
@@ -24,6 +26,8 @@ class MODULES_EXPORT WaitUntilObserver final
: public GarbageCollectedFinalized<WaitUntilObserver>,
public ContextLifecycleObserver {
USING_GARBAGE_COLLECTED_MIXIN(WaitUntilObserver);
+ using Callback = WTF::Function<void(blink::mojom::ServiceWorkerEventStatus,
+ const double&)>;
public:
enum EventType {
@@ -38,6 +42,9 @@ class MODULES_EXPORT WaitUntilObserver final
};
static WaitUntilObserver* create(ExecutionContext*, EventType, int eventID);
+ static WaitUntilObserver* create(ExecutionContext*,
+ EventType,
+ std::unique_ptr<Callback>);
// Must be called before and after dispatching the event.
void willDispatchEvent();
@@ -55,13 +62,19 @@ class MODULES_EXPORT WaitUntilObserver final
void incrementPendingActivity();
void decrementPendingActivity();
+ // Overriden from LifecycleObserver
+ void contextDestroyed() override;
+
DECLARE_VIRTUAL_TRACE();
private:
friend class InternalsServiceWorker;
class ThenFunction;
- WaitUntilObserver(ExecutionContext*, EventType, int eventID);
+ WaitUntilObserver(ExecutionContext*,
+ EventType,
+ int eventID,
+ std::unique_ptr<Callback>);
void reportError(const ScriptValue&);
@@ -74,6 +87,7 @@ class MODULES_EXPORT WaitUntilObserver final
bool m_eventDispatched = false;
double m_eventDispatchTime = 0;
Timer<WaitUntilObserver> m_consumeWindowInteractionTimer;
+ std::unique_ptr<Callback> m_callback;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698