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

Side by Side Diff: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h

Issue 2762663002: BackgroundFetchRegistration.abort() should return a Promise. (Closed)
Patch Set: Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 BackgroundFetchRegistration_h 5 #ifndef BackgroundFetchRegistration_h
6 #define BackgroundFetchRegistration_h 6 #define BackgroundFetchRegistration_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "platform/heap/GarbageCollected.h" 10 #include "platform/heap/GarbageCollected.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 #include "public/platform/modules/background_fetch/background_fetch.mojom-blink. h"
12 #include "wtf/text/WTFString.h" 13 #include "wtf/text/WTFString.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class IconDefinition; 17 class IconDefinition;
18 class ScriptPromiseResolver;
19 class ScriptState;
17 class ServiceWorkerRegistration; 20 class ServiceWorkerRegistration;
18 21
19 // Represents an individual Background Fetch registration. Gives developers 22 // Represents an individual Background Fetch registration. Gives developers
20 // access to its properties, options, and enables them to abort the fetch. 23 // access to its properties, options, and enables them to abort the fetch.
21 class BackgroundFetchRegistration final 24 class BackgroundFetchRegistration final
22 : public GarbageCollectedFinalized<BackgroundFetchRegistration>, 25 : public GarbageCollectedFinalized<BackgroundFetchRegistration>,
23 public ScriptWrappable { 26 public ScriptWrappable {
24 DEFINE_WRAPPERTYPEINFO(); 27 DEFINE_WRAPPERTYPEINFO();
25 28
26 public: 29 public:
27 BackgroundFetchRegistration(ServiceWorkerRegistration*, 30 BackgroundFetchRegistration(ServiceWorkerRegistration*,
28 String tag, 31 String tag,
29 HeapVector<IconDefinition> icons, 32 HeapVector<IconDefinition> icons,
30 long long totalDownloadSize, 33 long long totalDownloadSize,
31 String title); 34 String title);
32 ~BackgroundFetchRegistration(); 35 ~BackgroundFetchRegistration();
33 36
34 String tag() const; 37 String tag() const;
35 HeapVector<IconDefinition> icons() const; 38 HeapVector<IconDefinition> icons() const;
36 long long totalDownloadSize() const; 39 long long totalDownloadSize() const;
37 String title() const; 40 String title() const;
38 41
39 void abort(); 42 ScriptPromise abort(ScriptState*);
40 43
41 DECLARE_TRACE(); 44 DECLARE_TRACE();
42 45
43 private: 46 private:
47 void didAbort(ScriptPromiseResolver*, mojom::blink::BackgroundFetchError);
48
44 Member<ServiceWorkerRegistration> m_registration; 49 Member<ServiceWorkerRegistration> m_registration;
45 50
46 String m_tag; 51 String m_tag;
47 HeapVector<IconDefinition> m_icons; 52 HeapVector<IconDefinition> m_icons;
48 long long m_totalDownloadSize; 53 long long m_totalDownloadSize;
49 String m_title; 54 String m_title;
50 }; 55 };
51 56
52 } // namespace blink 57 } // namespace blink
53 58
54 #endif // BackgroundFetchRegistration_h 59 #endif // BackgroundFetchRegistration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698