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

Unified Diff: third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js

Issue 2818563006: ShapeDetection: Holding all of mock service to prevent GC (Closed)
Patch Set: ShapeDetection: Holding the MockFaceDetection to prevent Binding Object to be GCd Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
index 1faf89f7727c4a8bcbeb293978e3c643e5d2693a..52dc0d8d0e98a2e4f7dd08adb3c3a42cd572493f 100644
--- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
+++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
@@ -17,36 +17,42 @@ let mockFaceDetectionProviderReady = define(
interfaces.addInterfaceOverrideForTesting(
faceDetectionProvider.FaceDetectionProvider.name,
handle => this.bindingSet_.addBinding(this, handle));
+
+ this.serviceArray_ = [];
Ken Rockot(use gerrit already) 2017/05/03 16:48:54 nit: how about "mockServiceInstances_" instead of
+ this.buffer_data_ = [];
}
createFaceDetection(request, options) {
- this.mock_service_ = new MockFaceDetection(request, options);
+ this.maxDetectedFaces_ = options.max_detected_faces;
Ken Rockot(use gerrit already) 2017/05/03 16:48:54 Doesn't this effectively cause the same problem as
+ this.fastMode_ = options.fast_mode;
+
+ let mock_service = new MockFaceDetection(request, options, this);
Ken Rockot(use gerrit already) 2017/05/03 16:48:54 nit: Please either just delete this unnecessary li
+ this.serviceArray_.push(mock_service);
}
getFrameData() {
- return this.mock_service_.buffer_data_;
+ return this.buffer_data_;
Ken Rockot(use gerrit already) 2017/05/03 16:48:54 nit: While you're here, please fix the naming styl
}
getMaxDetectedFaces() {
- return this.mock_service_.maxDetectedFaces_;
+ return this.maxDetectedFaces_;
}
getFastMode () {
- return this.mock_service_.fastMode_;
+ return this.fastMode_;
}
}
class MockFaceDetection {
- constructor(request, options) {
- this.maxDetectedFaces_ = options.max_detected_faces;
- this.fastMode_ = options.fast_mode;
+ constructor(request, options, provider) {
+ this.provider_ = provider;
this.binding_ = new bindings.Binding(faceDetection.FaceDetection, this,
request);
}
detect(frame_data, width, height) {
let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0);
- this.buffer_data_ = new Uint32Array(receivedStruct.buffer);
+ this.provider_.buffer_data_ = new Uint32Array(receivedStruct.buffer);
return Promise.resolve({
result: {
bounding_boxes: [
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698