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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.h

Issue 2170783002: Add a timeout to the update event in case page doesn't resolve promise from updateWith (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 PaymentRequestUpdateEvent_h 5 #ifndef PaymentRequestUpdateEvent_h
6 #define PaymentRequestUpdateEvent_h 6 #define PaymentRequestUpdateEvent_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 "core/events/Event.h" 10 #include "core/events/Event.h"
11 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
12 #include "modules/payments/PaymentRequestUpdateEventInit.h" 12 #include "modules/payments/PaymentRequestUpdateEventInit.h"
13 #include "platform/Timer.h"
13 #include "platform/heap/Handle.h" 14 #include "platform/heap/Handle.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class ExceptionState; 18 class ExceptionState;
18 class PaymentUpdater; 19 class PaymentUpdater;
19 class ScriptState; 20 class ScriptState;
20 21
21 class MODULES_EXPORT PaymentRequestUpdateEvent final : public Event { 22 class MODULES_EXPORT PaymentRequestUpdateEvent final : public Event {
22 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
23 24
24 public: 25 public:
25 ~PaymentRequestUpdateEvent() override; 26 ~PaymentRequestUpdateEvent() override;
26 27
27 static PaymentRequestUpdateEvent* create(); 28 static PaymentRequestUpdateEvent* create();
28 static PaymentRequestUpdateEvent* create(const AtomicString& type, const Pay mentRequestUpdateEventInit& = PaymentRequestUpdateEventInit()); 29 static PaymentRequestUpdateEvent* create(const AtomicString& type, const Pay mentRequestUpdateEventInit& = PaymentRequestUpdateEventInit());
29 30
30 void setPaymentDetailsUpdater(PaymentUpdater*); 31 void setPaymentDetailsUpdater(PaymentUpdater*);
31 32
32 void updateWith(ScriptState*, ScriptPromise, ExceptionState&); 33 void updateWith(ScriptState*, ScriptPromise, ExceptionState&);
33 34
34 DECLARE_VIRTUAL_TRACE(); 35 DECLARE_VIRTUAL_TRACE();
35 36
37 static const int s_abortTimeout = 5;
please use gerrit instead 2016/07/21 16:35:24 s_waitForUpdateSeconds = 60; 60 seconds seems mor
pals 2016/07/22 04:06:19 Done.
38
36 private: 39 private:
37 PaymentRequestUpdateEvent(); 40 PaymentRequestUpdateEvent();
38 PaymentRequestUpdateEvent(const AtomicString& type, const PaymentRequestUpda teEventInit&); 41 PaymentRequestUpdateEvent(const AtomicString& type, const PaymentRequestUpda teEventInit&);
42 void onTimerFired(Timer<PaymentRequestUpdateEvent>*);
please use gerrit instead 2016/07/21 16:35:24 Make this public and call it from your unit test.
pals 2016/07/22 04:06:19 Done.
39 43
40 Member<PaymentUpdater> m_updater; 44 Member<PaymentUpdater> m_updater;
41 bool m_waitForUpdate; 45 bool m_waitForUpdate;
46 Timer<PaymentRequestUpdateEvent> m_abortTimer;
42 }; 47 };
43 48
44 } // namespace blink 49 } // namespace blink
45 50
46 #endif // PaymentRequestUpdateEvent_h 51 #endif // PaymentRequestUpdateEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698