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

Side by Side Diff: Source/modules/permissions/PermissionCallback.h

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix webusb ScriptPromiseResolver usage Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 PermissionCallback_h 5 #ifndef PermissionCallback_h
6 #define PermissionCallback_h 6 #define PermissionCallback_h
7 7
8 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 #include "public/platform/WebCallbacks.h" 9 #include "public/platform/WebCallbacks.h"
10 #include "public/platform/modules/permissions/WebPermissionStatus.h" 10 #include "public/platform/modules/permissions/WebPermissionStatus.h"
11 #include "public/platform/modules/permissions/WebPermissionType.h" 11 #include "public/platform/modules/permissions/WebPermissionType.h"
12 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
13 #include "wtf/PassRefPtr.h"
14 #include "wtf/RefPtr.h"
15 13
16 namespace blink { 14 namespace blink {
17 15
18 class ScriptPromiseResolver; 16 class ScriptPromiseResolver;
19 17
20 // PermissionQueryCallback is an implementation of WebPermissionCallbacks 18 // PermissionQueryCallback is an implementation of WebPermissionCallbacks
21 // that will resolve the underlying promise depending on the result passed to 19 // that will resolve the underlying promise depending on the result passed to
22 // the callback. It takes a WebPermissionType in its constructor and will pass 20 // the callback. It takes a WebPermissionType in its constructor and will pass
23 // it to the PermissionStatus. 21 // it to the PermissionStatus.
24 class PermissionCallback final 22 class PermissionCallback final
25 : public WebCallbacks<WebPermissionStatus*, void> { 23 : public WebCallbacks<WebPermissionStatus*, void> {
26 public: 24 public:
27 PermissionCallback(PassRefPtr<ScriptPromiseResolver>, WebPermissionType); 25 PermissionCallback(ScriptPromiseResolver*, WebPermissionType);
28 ~PermissionCallback() override; 26 ~PermissionCallback() override;
29 27
30 void onSuccess(WebPermissionStatus*) override; 28 void onSuccess(WebPermissionStatus*) override;
31 void onError() override; 29 void onError() override;
32 30
33 private: 31 private:
34 RefPtr<ScriptPromiseResolver> m_resolver; 32 Persistent<ScriptPromiseResolver> m_resolver;
35 WebPermissionType m_permissionType; 33 WebPermissionType m_permissionType;
36 34
37 WTF_MAKE_NONCOPYABLE(PermissionCallback); 35 WTF_MAKE_NONCOPYABLE(PermissionCallback);
38 }; 36 };
39 37
40 } // namespace blink 38 } // namespace blink
41 39
42 #endif // PermissionCallback_h 40 #endif // PermissionCallback_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698