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

Unified Diff: Source/bindings/core/v8/WrapCanvasContext.cpp

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years 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
Index: Source/bindings/core/v8/WrapCanvasContext.cpp
diff --git a/Source/bindings/core/v8/WrapCanvasContext.cpp b/Source/bindings/core/v8/WrapCanvasContext.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..559dfd021b1bdbc1fedc997c976db5eed8090f7b
--- /dev/null
+++ b/Source/bindings/core/v8/WrapCanvasContext.cpp
@@ -0,0 +1,41 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "bindings/core/v8/WrapCanvasContext.h"
+
+#include "bindings/core/v8/V8CanvasRenderingContext2D.h"
+#include "bindings/core/v8/V8WebGLRenderingContext.h"
+#include "core/html/HTMLCanvasElement.h"
+#include "core/inspector/InspectorCanvasInstrumentation.h"
+
+namespace blink {
+
+ScriptValue wrapCanvasContext(ScriptState* scriptState, HTMLCanvasElement* canvas, PassRefPtrWillBeRawPtr<CanvasRenderingContext2D> value)
+{
+ v8::Handle<v8::Value> v8Result = toV8(value, scriptState->context()->Global(), scriptState->isolate());
+ ScriptValue context(scriptState, v8Result);
+ if (InspectorInstrumentation::canvasAgentEnabled(&canvas->document())) {
+ ScriptValue wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(&canvas->document(), context);
+ if (!wrapped.isEmpty()) {
+ return wrapped;
+ }
+ }
+ return context;
+}
+
+ScriptValue wrapCanvasContext(ScriptState* scriptState, HTMLCanvasElement* canvas, PassRefPtrWillBeRawPtr<WebGLRenderingContext> value)
+{
+ v8::Handle<v8::Value> v8Result = toV8(value, scriptState->context()->Global(), scriptState->isolate());
+ ScriptValue context(scriptState, v8Result);
+ if (InspectorInstrumentation::canvasAgentEnabled(&canvas->document())) {
+ ScriptValue wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(&canvas->document(), context);
+ if (!wrapped.isEmpty()) {
+ return wrapped;
+ }
+ }
+ return context;
+}
+
+} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/WrapCanvasContext.h ('k') | Source/bindings/core/v8/custom/V8HTMLCanvasElementCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698