#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"
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);
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);
}