| 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, script_state_->GetExecutionContext(), | 115 V8ScriptRunner::CallFunction(paint, |
| 116 ExecutionContext::From(script_state_.Get()), |
| 116 instance, WTF_ARRAY_LENGTH(argv), argv, isolate); | 117 instance, WTF_ARRAY_LENGTH(argv), argv, isolate); |
| 117 | 118 |
| 118 // The paint function may have produced an error, in which case produce an | 119 // The paint function may have produced an error, in which case produce an |
| 119 // invalid image. | 120 // invalid image. |
| 120 if (block.HasCaught()) { | 121 if (block.HasCaught()) { |
| 121 return nullptr; | 122 return nullptr; |
| 122 } | 123 } |
| 123 | 124 |
| 124 return PaintGeneratedImage::Create( | 125 return PaintGeneratedImage::Create( |
| 125 rendering_context->GetImageBuffer()->GetRecord(), specified_size); | 126 rendering_context->GetImageBuffer()->GetRecord(), specified_size); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 138 v8::Local<v8::Object> paint_instance; | 139 v8::Local<v8::Object> paint_instance; |
| 139 if (V8ObjectConstructor::NewInstance(isolate, constructor) | 140 if (V8ObjectConstructor::NewInstance(isolate, constructor) |
| 140 .ToLocal(&paint_instance)) { | 141 .ToLocal(&paint_instance)) { |
| 141 instance_.Set(isolate, paint_instance); | 142 instance_.Set(isolate, paint_instance); |
| 142 } | 143 } |
| 143 | 144 |
| 144 did_call_constructor_ = true; | 145 did_call_constructor_ = true; |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |