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

Side by Side Diff: Source/modules/webusb/USB.cpp

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
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.h ('k') | Source/platform/CryptoResult.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "config.h" 5 #include "config.h"
6 #include "modules/webusb/USB.h" 6 #include "modules/webusb/USB.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 : m_controller(USBController::from(frame)) 75 : m_controller(USBController::from(frame))
76 { 76 {
77 } 77 }
78 78
79 ScriptPromise USB::getDevices(ScriptState* scriptState, const USBDeviceEnumerati onOptions& options) 79 ScriptPromise USB::getDevices(ScriptState* scriptState, const USBDeviceEnumerati onOptions& options)
80 { 80 {
81 WebUSBClient* client = m_controller->client(); 81 WebUSBClient* client = m_controller->client();
82 if (!client) 82 if (!client)
83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError)); 83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError));
84 84
85 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 85 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
86 ScriptPromise promise = resolver->promise(); 86 ScriptPromise promise = resolver->promise();
87 87
88 WebUSBDeviceEnumerationOptions webOptions; 88 WebUSBDeviceEnumerationOptions webOptions;
89 convertDeviceEnumerationOptions(options, &webOptions); 89 convertDeviceEnumerationOptions(options, &webOptions);
90 90
91 // TODO(rockot): Re-enable this after CPA changes land. 91 // TODO(rockot): Re-enable this after CPA changes land.
92 // That's https://codereview.chromium.org/1240763002/ and dependent patches. 92 // That's https://codereview.chromium.org/1240763002/ and dependent patches.
93 // client->getDevices(webOptions, new CallbackPromiseAdapter<DeviceArray, US BError>(resolver)); 93 // client->getDevices(webOptions, new CallbackPromiseAdapter<DeviceArray, US BError>(resolver));
94 ASSERT_NOT_REACHED(); 94 ASSERT_NOT_REACHED();
95 95
96 return promise; 96 return promise;
97 } 97 }
98 98
99 DEFINE_TRACE(USB) 99 DEFINE_TRACE(USB)
100 { 100 {
101 visitor->trace(m_controller); 101 visitor->trace(m_controller);
102 } 102 }
103 103
104 } // namespace blink 104 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.h ('k') | Source/platform/CryptoResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698