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

Side by Side Diff: third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 #include "modules/imagecapture/ImageCapture.h" 5 #include "modules/imagecapture/ImageCapture.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
11 #include "core/fileapi/Blob.h" 11 #include "core/fileapi/Blob.h"
12 #include "core/frame/ImageBitmap.h" 12 #include "core/frame/ImageBitmap.h"
13 #include "modules/EventTargetModules.h" 13 #include "modules/EventTargetModules.h"
14 #include "modules/imagecapture/MediaSettingsRange.h" 14 #include "modules/imagecapture/MediaSettingsRange.h"
15 #include "modules/imagecapture/PhotoCapabilities.h" 15 #include "modules/imagecapture/PhotoCapabilities.h"
16 #include "modules/imagecapture/PhotoSettings.h" 16 #include "modules/imagecapture/PhotoSettings.h"
17 #include "modules/mediastream/MediaStreamTrack.h" 17 #include "modules/mediastream/MediaStreamTrack.h"
18 #include "platform/mojo/MojoHelper.h" 18 #include "platform/mojo/MojoHelper.h"
19 #include "public/platform/Platform.h" 19 #include "public/platform/Platform.h"
20 #include "public/platform/ServiceRegistry.h" 20 #include "public/platform/ServiceRegistry.h"
21 #include "public/platform/WebImageCaptureFrameGrabber.h" 21 #include "public/platform/WebImageCaptureFrameGrabber.h"
22 #include "public/platform/WebMediaStreamTrack.h" 22 #include "public/platform/WebMediaStreamTrack.h"
23 #include "wtf/PtrUtil.h"
23 24
24 namespace blink { 25 namespace blink {
25 26
26 namespace { 27 namespace {
27 28
28 const char kNoServiceError[] = "ImageCapture service unavailable."; 29 const char kNoServiceError[] = "ImageCapture service unavailable.";
29 30
30 bool trackIsInactive(const MediaStreamTrack& track) 31 bool trackIsInactive(const MediaStreamTrack& track)
31 { 32 {
32 // Spec instructs to return an exception if the Track's readyState() is not 33 // Spec instructs to return an exception if the Track's readyState() is not
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 153 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
153 ScriptPromise promise = resolver->promise(); 154 ScriptPromise promise = resolver->promise();
154 155
155 if (trackIsInactive(*m_streamTrack)) { 156 if (trackIsInactive(*m_streamTrack)) {
156 resolver->reject(DOMException::create(InvalidStateError, "The associated Track is in an invalid state.")); 157 resolver->reject(DOMException::create(InvalidStateError, "The associated Track is in an invalid state."));
157 return promise; 158 return promise;
158 } 159 }
159 160
160 // Create |m_frameGrabber| the first time. 161 // Create |m_frameGrabber| the first time.
161 if (!m_frameGrabber) 162 if (!m_frameGrabber)
162 m_frameGrabber = adoptPtr(Platform::current()->createImageCaptureFrameGr abber()); 163 m_frameGrabber = wrapUnique(Platform::current()->createImageCaptureFrame Grabber());
163 164
164 if (!m_frameGrabber) { 165 if (!m_frameGrabber) {
165 resolver->reject(DOMException::create(UnknownError, "Couldn't create pla tform resources")); 166 resolver->reject(DOMException::create(UnknownError, "Couldn't create pla tform resources"));
166 return promise; 167 return promise;
167 } 168 }
168 169
169 // The platform does not know about MediaStreamTrack, so we wrap it up. 170 // The platform does not know about MediaStreamTrack, so we wrap it up.
170 WebMediaStreamTrack track(m_streamTrack->component()); 171 WebMediaStreamTrack track(m_streamTrack->component());
171 m_frameGrabber->grabFrame(&track, new CallbackPromiseAdapter<ImageBitmap, vo id>(resolver)); 172 m_frameGrabber->grabFrame(&track, new CallbackPromiseAdapter<ImageBitmap, vo id>(resolver));
172 173
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 DEFINE_TRACE(ImageCapture) 242 DEFINE_TRACE(ImageCapture)
242 { 243 {
243 visitor->trace(m_streamTrack); 244 visitor->trace(m_streamTrack);
244 visitor->trace(m_serviceRequests); 245 visitor->trace(m_serviceRequests);
245 EventTargetWithInlineData::trace(visitor); 246 EventTargetWithInlineData::trace(visitor);
246 ContextLifecycleObserver::trace(visitor); 247 ContextLifecycleObserver::trace(visitor);
247 } 248 }
248 249
249 } // namespace blink 250 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/imagecapture/ImageCapture.h ('k') | third_party/WebKit/Source/modules/indexeddb/IDBCursor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698