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

Side by Side Diff: third_party/WebKit/Source/modules/vr/NavigatorVRDevice.cpp

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to ToT again! Created 4 years, 7 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 #include "modules/vr/NavigatorVRDevice.h" 5 #include "modules/vr/NavigatorVRDevice.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ScriptPromise promise = resolver->promise(); 51 ScriptPromise promise = resolver->promise();
52 52
53 Document* document = m_frame ? m_frame->document() : 0; 53 Document* document = m_frame ? m_frame->document() : 0;
54 54
55 if (!document || !controller()) { 55 if (!document || !controller()) {
56 DOMException* exception = DOMException::create(InvalidStateError, "The o bject is no longer associated to a document."); 56 DOMException* exception = DOMException::create(InvalidStateError, "The o bject is no longer associated to a document.");
57 resolver->reject(exception); 57 resolver->reject(exception);
58 return promise; 58 return promise;
59 } 59 }
60 60
61 controller()->getDevices(new VRGetDevicesCallback(resolver, m_hardwareUnits. get())); 61 std::unique_ptr<VRGetDevicesCallback> callback(new VRGetDevicesCallback(reso lver, m_hardwareUnits.get()));
62 controller()->getDevices(std::move(callback));
esprehn 2016/05/06 03:14:53 You want to use WTF::wrapUnique here.
RaviKasibhatla 2016/05/06 09:15:49 Done.
62 63
63 return promise; 64 return promise;
64 } 65 }
65 66
66 VRController* NavigatorVRDevice::controller() 67 VRController* NavigatorVRDevice::controller()
67 { 68 {
68 if (!frame()) 69 if (!frame())
69 return 0; 70 return 0;
70 71
71 return VRController::from(*frame()); 72 return VRController::from(*frame());
(...skipping 12 matching lines...) Expand all
84 { 85 {
85 m_hardwareUnits = new VRHardwareUnitCollection(this); 86 m_hardwareUnits = new VRHardwareUnitCollection(this);
86 } 87 }
87 88
88 const char* NavigatorVRDevice::supplementName() 89 const char* NavigatorVRDevice::supplementName()
89 { 90 {
90 return "NavigatorVRDevice"; 91 return "NavigatorVRDevice";
91 } 92 }
92 93
93 } // namespace blink 94 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698