Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / renderer / skia_benchmarking_extension.cc
index 3f94791..7c957a5 100644 (file)
@@ -16,6 +16,7 @@
 #include "gin/object_template_builder.h"
 #include "skia/ext/benchmarking_canvas.h"
 #include "third_party/WebKit/public/platform/WebArrayBuffer.h"
+#include "third_party/WebKit/public/web/WebArrayBufferConverter.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 #include "third_party/skia/include/core/SkBitmapDevice.h"
@@ -153,14 +154,10 @@ void SkiaBenchmarking::Rasterize(gin::Arguments* args) {
   clip.Scale(scale);
   gfx::Rect snapped_clip = gfx::ToEnclosingRect(clip);
 
-  const int kMaxBitmapSize = 4096;
-  if (snapped_clip.width() > kMaxBitmapSize ||
-      snapped_clip.height() > kMaxBitmapSize)
-    return;
-
   SkBitmap bitmap;
-  bitmap.setConfig(
-      SkBitmap::kARGB_8888_Config, snapped_clip.width(), snapped_clip.height());
+  if (!bitmap.setConfig(SkBitmap::kARGB_8888_Config, snapped_clip.width(),
+                        snapped_clip.height()))
+    return;
   if (!bitmap.allocPixels())
     return;
   bitmap.eraseARGB(0, 0, 0, 0);
@@ -203,7 +200,8 @@ void SkiaBenchmarking::Rasterize(gin::Arguments* args) {
               v8::Number::New(isolate, snapped_clip.width()));
   result->Set(v8::String::NewFromUtf8(isolate, "height"),
               v8::Number::New(isolate, snapped_clip.height()));
-  result->Set(v8::String::NewFromUtf8(isolate, "data"), buffer.toV8Value());
+  result->Set(v8::String::NewFromUtf8(isolate, "data"),
+              blink::WebArrayBufferConverter::toV8Value(&buffer));
 
   args->Return(result);
 }