| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get(
)); | 95 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get(
)); |
| 96 if (!result) { | 96 if (!result) { |
| 97 v8SetReturnValueNull(info); | 97 v8SetReturnValueNull(info); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 if (result->is2d()) { | 100 if (result->is2d()) { |
| 101 v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result)
, info.Holder(), info.GetIsolate()); | 101 v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result)
, info.Holder(), info.GetIsolate()); |
| 102 if (InspectorInstrumentation::canvasAgentEnabled(&impl->document())) { | 102 if (InspectorInstrumentation::canvasAgentEnabled(&impl->document())) { |
| 103 ScriptState* scriptState = ScriptState::current(isolate); | 103 ScriptState* scriptState = ScriptState::current(isolate); |
| 104 ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Res
ult)); | 104 ScriptValue context(scriptState, v8Result); |
| 105 ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderi
ngContextForInstrumentation(&impl->document(), context); | 105 ScriptValue wrapped = InspectorInstrumentation::wrapCanvas2DRenderin
gContextForInstrumentation(&impl->document(), context); |
| 106 if (!wrapped.isEmpty()) { | 106 if (!wrapped.isEmpty()) { |
| 107 v8SetReturnValue(info, wrapped.v8Value()); | 107 v8SetReturnValue(info, wrapped.v8Value()); |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 v8SetReturnValue(info, v8Result); | 111 v8SetReturnValue(info, v8Result); |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 if (result->is3d()) { | 114 if (result->is3d()) { |
| 115 v8::Handle<v8::Value> v8Result = toV8(toWebGLRenderingContext(result), i
nfo.Holder(), info.GetIsolate()); | 115 v8::Handle<v8::Value> v8Result = toV8(toWebGLRenderingContext(result), i
nfo.Holder(), info.GetIsolate()); |
| 116 if (InspectorInstrumentation::canvasAgentEnabled(&impl->document())) { | 116 if (InspectorInstrumentation::canvasAgentEnabled(&impl->document())) { |
| 117 ScriptState* scriptState = ScriptState::current(isolate); | 117 ScriptState* scriptState = ScriptState::current(isolate); |
| 118 ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8R
esult)); | 118 ScriptValue glContext(scriptState, v8Result); |
| 119 ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingC
ontextForInstrumentation(&impl->document(), glContext); | 119 ScriptValue wrapped = InspectorInstrumentation::wrapWebGLRenderingCo
ntextForInstrumentation(&impl->document(), glContext); |
| 120 if (!wrapped.isEmpty()) { | 120 if (!wrapped.isEmpty()) { |
| 121 v8SetReturnValue(info, wrapped.v8Value()); | 121 v8SetReturnValue(info, wrapped.v8Value()); |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 v8SetReturnValue(info, v8Result); | 125 v8SetReturnValue(info, v8Result); |
| 126 return; | 126 return; |
| 127 } | 127 } |
| 128 ASSERT_NOT_REACHED(); | 128 ASSERT_NOT_REACHED(); |
| 129 v8SetReturnValueNull(info); | 129 v8SetReturnValueNull(info); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 142 quality = info[1]->NumberValue(); | 142 quality = info[1]->NumberValue(); |
| 143 qualityPtr = &quality; | 143 qualityPtr = &quality; |
| 144 } | 144 } |
| 145 | 145 |
| 146 String result = canvas->toDataURL(type, qualityPtr, exceptionState); | 146 String result = canvas->toDataURL(type, qualityPtr, exceptionState); |
| 147 exceptionState.throwIfNeeded(); | 147 exceptionState.throwIfNeeded(); |
| 148 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate()); | 148 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace WebCore | 151 } // namespace WebCore |
| OLD | NEW |