OLD | NEW |
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/csspaint/CSSPaintDefinition.h" | 5 #include "modules/csspaint/CSSPaintDefinition.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
10 #include "bindings/core/v8/V8ObjectConstructor.h" | 10 #include "bindings/core/v8/V8ObjectConstructor.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ToV8(rendering_context, script_state_->GetContext()->Global(), isolate), | 105 ToV8(rendering_context, script_state_->GetContext()->Global(), isolate), |
106 ToV8(paint_size, script_state_->GetContext()->Global(), isolate), | 106 ToV8(paint_size, script_state_->GetContext()->Global(), isolate), |
107 ToV8(style_map, script_state_->GetContext()->Global(), isolate), | 107 ToV8(style_map, script_state_->GetContext()->Global(), isolate), |
108 ToV8(*paint_arguments, script_state_->GetContext()->Global(), isolate)}; | 108 ToV8(*paint_arguments, script_state_->GetContext()->Global(), isolate)}; |
109 | 109 |
110 v8::Local<v8::Function> paint = paint_.NewLocal(isolate); | 110 v8::Local<v8::Function> paint = paint_.NewLocal(isolate); |
111 | 111 |
112 v8::TryCatch block(isolate); | 112 v8::TryCatch block(isolate); |
113 block.SetVerbose(true); | 113 block.SetVerbose(true); |
114 | 114 |
115 V8ScriptRunner::CallFunction(paint, | 115 V8ScriptRunner::CallFunction(paint, script_state_->GetExecutionContext(), |
116 ExecutionContext::From(script_state_.Get()), | |
117 instance, WTF_ARRAY_LENGTH(argv), argv, isolate); | 116 instance, WTF_ARRAY_LENGTH(argv), argv, isolate); |
118 | 117 |
119 // The paint function may have produced an error, in which case produce an | 118 // The paint function may have produced an error, in which case produce an |
120 // invalid image. | 119 // invalid image. |
121 if (block.HasCaught()) { | 120 if (block.HasCaught()) { |
122 return nullptr; | 121 return nullptr; |
123 } | 122 } |
124 | 123 |
125 return PaintGeneratedImage::Create( | 124 return PaintGeneratedImage::Create( |
126 rendering_context->GetImageBuffer()->GetRecord(), specified_size); | 125 rendering_context->GetImageBuffer()->GetRecord(), specified_size); |
(...skipping 12 matching lines...) Expand all Loading... |
139 v8::Local<v8::Object> paint_instance; | 138 v8::Local<v8::Object> paint_instance; |
140 if (V8ObjectConstructor::NewInstance(isolate, constructor) | 139 if (V8ObjectConstructor::NewInstance(isolate, constructor) |
141 .ToLocal(&paint_instance)) { | 140 .ToLocal(&paint_instance)) { |
142 instance_.Set(isolate, paint_instance); | 141 instance_.Set(isolate, paint_instance); |
143 } | 142 } |
144 | 143 |
145 did_call_constructor_ = true; | 144 did_call_constructor_ = true; |
146 } | 145 } |
147 | 146 |
148 } // namespace blink | 147 } // namespace blink |
OLD | NEW |