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

Side by Side Diff: third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp

Issue 2629523008: Shape Detection: Remove ConstructorCallWith=Document (Closed)
Patch Set: Add layout test for worker Created 3 years, 11 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/shapedetection/ShapeDetector.h" 5 #include "modules/shapedetection/ShapeDetector.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/dom/DOMRect.h" 8 #include "core/dom/DOMRect.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/ImageBitmap.h" 10 #include "core/frame/ImageBitmap.h"
(...skipping 30 matching lines...) Expand all
41 const mojo::ScopedSharedBufferMapping mappedBuffer = 41 const mojo::ScopedSharedBufferMapping mappedBuffer =
42 sharedBufferHandle->Map(size); 42 sharedBufferHandle->Map(size);
43 DCHECK(mappedBuffer.get()); 43 DCHECK(mappedBuffer.get());
44 memcpy(mappedBuffer.get(), data, size); 44 memcpy(mappedBuffer.get(), data, size);
45 45
46 return sharedBufferHandle; 46 return sharedBufferHandle;
47 } 47 }
48 48
49 } // anonymous namespace 49 } // anonymous namespace
50 50
51 ShapeDetector::ShapeDetector(LocalFrame& frame) {
52 DCHECK(frame.interfaceProvider());
53 }
54
55 ScriptPromise ShapeDetector::detect(ScriptState* scriptState, 51 ScriptPromise ShapeDetector::detect(ScriptState* scriptState,
56 const ImageBitmapSourceUnion& imageSource) { 52 const ImageBitmapSourceUnion& imageSource) {
57 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 53 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
58 ScriptPromise promise = resolver->promise(); 54 ScriptPromise promise = resolver->promise();
59 55
60 // ImageDatas cannot be tainted by definition. 56 // ImageDatas cannot be tainted by definition.
61 if (imageSource.isImageData()) 57 if (imageSource.isImageData())
62 return detectShapesOnImageData(resolver, imageSource.getAsImageData()); 58 return detectShapesOnImageData(resolver, imageSource.getAsImageData());
63 59
64 CanvasImageSource* canvasImageSource; 60 CanvasImageSource* canvasImageSource;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 InvalidStateError, 230 InvalidStateError,
235 "Failed to read pixels: Unable to decompress or unsupported format.")); 231 "Failed to read pixels: Unable to decompress or unsupported format."));
236 return promise; 232 return promise;
237 } 233 }
238 234
239 return doDetect(resolver, std::move(sharedBufferHandle), img->naturalWidth(), 235 return doDetect(resolver, std::move(sharedBufferHandle), img->naturalWidth(),
240 img->naturalHeight()); 236 img->naturalHeight());
241 } 237 }
242 238
243 } // namespace blink 239 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698