Commit 7c43bda8 authored by yurys@chromium.org's avatar yurys@chromium.org
Browse files

Unreviewed, rolling out r129219.

http://trac.webkit.org/changeset/129219
https://bugs.webkit.org/show_bug.cgi?id=97338

Presumably broke Apple Mac compilation (Requested by yurys_ on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-21

* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::getContext):
* bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
(WebCore::V8HTMLCanvasElement::getContextCallback):
* inspector/InjectedScriptCanvasModule.cpp:
(WebCore::InjectedScriptCanvasModule::wrapWebGLContext):
(WebCore):
* inspector/InjectedScriptCanvasModule.h:
(InjectedScriptCanvasModule):
* inspector/InspectorCanvasAgent.cpp:
* inspector/InspectorCanvasAgent.h:
* inspector/InspectorCanvasInstrumentation.h:
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7cc571e3
2012-09-21 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r129219.
http://trac.webkit.org/changeset/129219
https://bugs.webkit.org/show_bug.cgi?id=97338
Presumably broke Apple Mac compilation (Requested by yurys_ on
#webkit).
* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::getContext):
* bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
(WebCore::V8HTMLCanvasElement::getContextCallback):
* inspector/InjectedScriptCanvasModule.cpp:
(WebCore::InjectedScriptCanvasModule::wrapWebGLContext):
(WebCore):
* inspector/InjectedScriptCanvasModule.h:
(InjectedScriptCanvasModule):
* inspector/InspectorCanvasAgent.cpp:
* inspector/InspectorCanvasAgent.h:
* inspector/InspectorCanvasInstrumentation.h:
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
2012-09-21 Andrey Adaikin <aandrey@chromium.org>
 
Web Inspector: [Canvas] support 2D canvas instrumentation from the inspector C++ code
......@@ -29,11 +29,11 @@
#include "CanvasContextAttributes.h"
#include "HTMLCanvasElement.h"
#include "InspectorCanvasInstrumentation.h"
#include "JSCanvasRenderingContext2D.h"
#include "ScriptObject.h"
#if ENABLE(WEBGL)
#include "InspectorCanvasInstrumentation.h"
#include "JSWebGLRenderingContext.h"
#include "ScriptObject.h"
#include "WebGLContextAttributes.h"
#endif
#include <wtf/GetPtr.h>
......@@ -78,18 +78,14 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
if (!context)
return jsNull();
JSValue jsValue = toJS(exec, globalObject(), WTF::getPtr(context));
if (InspectorInstrumentation::hasFrontends()) {
ScriptObject contextObject(exec, jsValue.getObject());
ScriptObject wrapped;
if (context->is2d())
wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(canvas->document(), contextObject);
#if ENABLE(WEBGL)
else if (context->is3d())
wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(canvas->document(), contextObject);
#endif
if (context->is3d() && InspectorInstrumentation::hasFrontends()) {
ScriptObject glContext(exec, jsValue.getObject());
ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(canvas->document(), glContext);
if (!wrapped.hasNoValue())
return wrapped.jsValue();
}
#endif
return jsValue;
}
......
......@@ -35,12 +35,12 @@
#include "CanvasContextAttributes.h"
#include "CanvasRenderingContext.h"
#include "HTMLCanvasElement.h"
#include "InspectorCanvasInstrumentation.h"
#include "WebGLContextAttributes.h"
#include "V8Binding.h"
#include "V8CanvasRenderingContext2D.h"
#include "V8Node.h"
#if ENABLE(WEBGL)
#include "InspectorCanvasInstrumentation.h"
#include "V8WebGLRenderingContext.h"
#endif
#include <wtf/MathExtras.h>
......@@ -85,17 +85,9 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
if (!result)
return v8::Null(args.GetIsolate());
else if (result->is2d()) {
v8::Handle<v8::Value> v8Result = toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
if (InspectorInstrumentation::hasFrontends()) {
ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(imp->document(), context);
if (!wrapped.hasNoValue())
return wrapped.v8Value();
}
return v8Result;
}
if (result->is2d())
return toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
#if ENABLE(WEBGL)
else if (result->is3d()) {
// 3D canvas contexts can hold on to lots of GPU resources, and we want to take an
......
......@@ -59,30 +59,20 @@ String InjectedScriptCanvasModule::source() const
return String(reinterpret_cast<const char*>(InjectedScriptCanvasModuleSource_js), sizeof(InjectedScriptCanvasModuleSource_js));
}
ScriptObject InjectedScriptCanvasModule::wrapCanvas2DContext(const ScriptObject& context)
{
return callWrapContextFunction("wrapCanvas2DContext", context);
}
#if ENABLE(WEBGL)
ScriptObject InjectedScriptCanvasModule::wrapWebGLContext(const ScriptObject& glContext)
{
return callWrapContextFunction("wrapWebGLContext", glContext);
}
#endif // ENABLE(WEBGL)
ScriptObject InjectedScriptCanvasModule::callWrapContextFunction(const String& functionName, const ScriptObject& context)
{
ScriptFunctionCall function(injectedScriptObject(), functionName);
function.appendArgument(context);
ScriptFunctionCall function(injectedScriptObject(), "wrapWebGLContext");
function.appendArgument(glContext);
bool hadException = false;
ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
ASSERT_NOT_REACHED();
return ScriptObject();
}
return ScriptObject(context.scriptState(), resultValue);
return ScriptObject(glContext.scriptState(), resultValue);
}
#endif // ENABLE(WEBGL)
void InjectedScriptCanvasModule::captureFrame(ErrorString* errorString, String* traceLogId)
{
......
......@@ -50,18 +50,14 @@ public:
static InjectedScriptCanvasModule moduleForState(InjectedScriptManager*, ScriptState*);
ScriptObject wrapCanvas2DContext(const ScriptObject&);
#if ENABLE(WEBGL)
ScriptObject wrapWebGLContext(const ScriptObject&);
ScriptObject wrapWebGLContext(const ScriptObject& glContext);
#endif
void captureFrame(ErrorString*, String*);
void dropTraceLog(ErrorString*, const String&);
void traceLog(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::TraceLog>*);
void replayTraceLog(ErrorString*, const String&, int, String*);
private:
ScriptObject callWrapContextFunction(const String&, const ScriptObject&);
};
#endif
......
......@@ -130,20 +130,6 @@ void InspectorCanvasAgent::replayTraceLog(ErrorString* errorString, const String
module.replayTraceLog(errorString, traceLogId, stepNo, result);
}
ScriptObject InspectorCanvasAgent::wrapCanvas2DRenderingContextForInstrumentation(const ScriptObject& context)
{
if (context.hasNoValue()) {
ASSERT_NOT_REACHED();
return ScriptObject();
}
InjectedScriptCanvasModule module = InjectedScriptCanvasModule::moduleForState(m_injectedScriptManager, context.scriptState());
if (module.hasNoValue()) {
ASSERT_NOT_REACHED();
return ScriptObject();
}
return module.wrapCanvas2DContext(context);
}
#if ENABLE(WEBGL)
ScriptObject InspectorCanvasAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
{
......
......@@ -66,7 +66,6 @@ public:
bool enabled() { return m_enabled; }
ScriptObject wrapCanvas2DRenderingContextForInstrumentation(const ScriptObject&);
#if ENABLE(WEBGL)
ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&);
#endif
......
......@@ -38,18 +38,6 @@
namespace WebCore {
ScriptObject InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(Document* document, const ScriptObject& context)
{
#if ENABLE(INSPECTOR)
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {
InspectorCanvasAgent* canvasAgent = instrumentingAgents->inspectorCanvasAgent();
if (canvasAgent && canvasAgent->enabled())
return canvasAgent->wrapCanvas2DRenderingContextForInstrumentation(context);
}
#endif
return ScriptObject();
}
#if ENABLE(WEBGL)
ScriptObject InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(Document* document, const ScriptObject& glContext)
{
......
......@@ -251,7 +251,6 @@ public:
static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
#endif
static ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptObject&);
#if ENABLE(WEBGL)
static ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptObject&);
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment