Commit cd8a5d51 authored by eric@webkit.org's avatar eric@webkit.org

2010-02-03 Mikhail Naganov <mnaganov@chromium.org>

        Reviewed by Pavel Feldman.

        Start unforking debugger and profiler code.

        Remove custom implementation of Console.
        Add 'ScriptProfiler' and 'ScriptProfile' types.
        Start migration to engine-neutral types in InspectorController.

        https://bugs.webkit.org/show_bug.cgi?id=34481

        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSBindingsAllInOne.cpp:
        * bindings/js/JSConsoleCustom.cpp:
        * bindings/js/ScriptProfile.h: Added.
        * bindings/js/ScriptProfiler.cpp: Added.
        (WebCore::ScriptProfiler::start):
        (WebCore::ScriptProfiler::stop):
        * bindings/js/ScriptProfiler.h: Added.
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/ScriptProfile.h: Added.
        (WebCore::ScriptProfile::create):
        (WebCore::ScriptProfile::~ScriptProfile):
        (WebCore::ScriptProfile::title):
        (WebCore::ScriptProfile::uid):
        (WebCore::ScriptProfile::ScriptProfile):
        * bindings/v8/ScriptProfiler.cpp: Added.
        (WebCore::ScriptProfiler::start):
        (WebCore::ScriptProfiler::stop):
        * bindings/v8/ScriptProfiler.h: Added.
        * bindings/v8/custom/V8ConsoleCustom.cpp: Removed.
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::endGroup):
        (WebCore::InspectorController::show):
        (WebCore::InspectorController::setDOMStorageItem):
        (WebCore::InspectorController::addProfile):
        (WebCore::InspectorController::addProfileFinishedMessageToConsole):
        (WebCore::InspectorController::addStartProfilingMessageToConsole):
        (WebCore::InspectorController::createProfileHeader):
        (WebCore::InspectorController::getCurrentUserInitiatedProfileName):
        (WebCore::InspectorController::startUserInitiatedProfiling):
        (WebCore::InspectorController::stopUserInitiatedProfiling):
        (WebCore::InspectorController::enableDebugger):
        (WebCore::InspectorController::specialPanelForJSName):
        * inspector/InspectorController.h:
        (WebCore::InspectorController::searchingForNodeInPage):
        * page/Console.cpp:
        (WebCore::Console::profile):
        (WebCore::Console::profileEnd):
        * page/Console.h:
        (WebCore::):
        (WebCore::Console::create):
        (WebCore::Console::profiles):
        * page/Console.idl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 05b04250
2010-02-03 Mikhail Naganov <mnaganov@chromium.org>
Reviewed by Pavel Feldman.
Start unforking debugger and profiler code.
Remove custom implementation of Console.
Add 'ScriptProfiler' and 'ScriptProfile' types.
Start migration to engine-neutral types in InspectorController.
https://bugs.webkit.org/show_bug.cgi?id=34481
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSConsoleCustom.cpp:
* bindings/js/ScriptProfile.h: Added.
* bindings/js/ScriptProfiler.cpp: Added.
(WebCore::ScriptProfiler::start):
(WebCore::ScriptProfiler::stop):
* bindings/js/ScriptProfiler.h: Added.
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/v8/ScriptProfile.h: Added.
(WebCore::ScriptProfile::create):
(WebCore::ScriptProfile::~ScriptProfile):
(WebCore::ScriptProfile::title):
(WebCore::ScriptProfile::uid):
(WebCore::ScriptProfile::ScriptProfile):
* bindings/v8/ScriptProfiler.cpp: Added.
(WebCore::ScriptProfiler::start):
(WebCore::ScriptProfiler::stop):
* bindings/v8/ScriptProfiler.h: Added.
* bindings/v8/custom/V8ConsoleCustom.cpp: Removed.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::endGroup):
(WebCore::InspectorController::show):
(WebCore::InspectorController::setDOMStorageItem):
(WebCore::InspectorController::addProfile):
(WebCore::InspectorController::addProfileFinishedMessageToConsole):
(WebCore::InspectorController::addStartProfilingMessageToConsole):
(WebCore::InspectorController::createProfileHeader):
(WebCore::InspectorController::getCurrentUserInitiatedProfileName):
(WebCore::InspectorController::startUserInitiatedProfiling):
(WebCore::InspectorController::stopUserInitiatedProfiling):
(WebCore::InspectorController::enableDebugger):
(WebCore::InspectorController::specialPanelForJSName):
* inspector/InspectorController.h:
(WebCore::InspectorController::searchingForNodeInPage):
* page/Console.cpp:
(WebCore::Console::profile):
(WebCore::Console::profileEnd):
* page/Console.h:
(WebCore::):
(WebCore::Console::create):
(WebCore::Console::profiles):
* page/Console.idl:
2010-02-02 Kent Tamura <tkent@chromium.org>
Reviewed by Darin Adler.
......
......@@ -484,6 +484,9 @@ webcore_sources += \
WebCore/bindings/js/ScriptInstance.h \
WebCore/bindings/js/ScriptObject.cpp \
WebCore/bindings/js/ScriptObject.h \
WebCore/bindings/js/ScriptProfile.h \
WebCore/bindings/js/ScriptProfiler.cpp \
WebCore/bindings/js/ScriptProfiler.h \
WebCore/bindings/js/ScriptSourceCode.h \
WebCore/bindings/js/ScriptSourceProvider.h \
WebCore/bindings/js/ScriptState.cpp \
......
......@@ -674,7 +674,6 @@
'bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp',
'bindings/v8/custom/V8CSSStyleSheetCustom.cpp',
'bindings/v8/custom/V8CSSValueCustom.cpp',
'bindings/v8/custom/V8ConsoleCustom.cpp',
'bindings/v8/custom/V8CustomBinding.h',
'bindings/v8/custom/V8CustomEventListener.cpp',
'bindings/v8/custom/V8CustomEventListener.h',
......@@ -810,6 +809,9 @@
'bindings/v8/ScriptInstance.h',
'bindings/v8/ScriptObject.cpp',
'bindings/v8/ScriptObject.h',
'bindings/v8/ScriptProfile.h',
'bindings/v8/ScriptProfiler.cpp',
'bindings/v8/ScriptProfiler.h',
'bindings/v8/ScriptScope.cpp',
'bindings/v8/ScriptScope.h',
'bindings/v8/ScriptSourceCode.h',
......
......@@ -346,6 +346,7 @@ SOURCES += \
bindings/js/ScriptEventListener.cpp \
bindings/js/ScriptFunctionCall.cpp \
bindings/js/ScriptObject.cpp \
bindings/js/ScriptProfiler.cpp \
bindings/js/ScriptState.cpp \
bindings/js/ScriptValue.cpp \
bindings/js/ScheduledAction.cpp \
......
......@@ -2455,6 +2455,9 @@
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */; };
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; };
97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; };
9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304C11184B4100AD0126 /* ScriptProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */; };
9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304E11184B4100AD0126 /* ScriptProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -7789,6 +7792,9 @@
97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSSAuditor.cpp; sourceTree = "<group>"; };
97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; };
97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; };
9F72304C11184B4100AD0126 /* ScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfile.h; sourceTree = "<group>"; };
9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfiler.cpp; sourceTree = "<group>"; };
9F72304E11184B4100AD0126 /* ScriptProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfiler.h; sourceTree = "<group>"; };
A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; };
A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
......@@ -14621,6 +14627,9 @@
934CC1160EDCAC7300A658F2 /* ScriptInstance.h */,
41F066E30F64BCF600A07EAC /* ScriptObject.cpp */,
41F066E20F64BCF600A07EAC /* ScriptObject.h */,
9F72304C11184B4100AD0126 /* ScriptProfile.h */,
9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */,
9F72304E11184B4100AD0126 /* ScriptProfiler.h */,
934CC1090EDB223900A658F2 /* ScriptSourceCode.h */,
CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */,
4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */,
......@@ -18487,6 +18496,8 @@
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */,
B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */,
9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */,
9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -20663,6 +20674,7 @@
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */,
B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */,
9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -142,6 +142,7 @@
#include "ScriptControllerWin.cpp"
#include "ScriptEventListener.cpp"
#include "ScriptFunctionCall.cpp"
#include "ScriptProfiler.cpp"
#include "ScriptState.cpp"
#include "SerializedScriptValue.cpp"
#include "WorkerScriptController.cpp"
......@@ -24,13 +24,14 @@
*/
#include "config.h"
#include "JSConsole.h"
#include "Console.h"
#include "JavaScriptProfile.h"
#include "ScriptCallStack.h"
#include <runtime/JSArray.h>
#include "Console.h"
using namespace JSC;
namespace WebCore {
......@@ -51,22 +52,6 @@ JSValue JSConsole::profiles(ExecState* exec) const
return constructArray(exec, list);
}
JSValue JSConsole::profile(ExecState* exec, const ArgList& args)
{
ScriptCallStack callStack(exec, args, 1);
const UString title = valueToStringWithUndefinedOrNullCheck(exec, args.at(0));
impl()->profile(title, &callStack);
return jsUndefined();
}
JSValue JSConsole::profileEnd(ExecState* exec, const ArgList& args)
{
ScriptCallStack callStack(exec, args, 1);
const UString title = valueToStringWithUndefinedOrNullCheck(exec, args.at(0));
impl()->profileEnd(title, &callStack);
return jsUndefined();
}
#endif
} // namespace WebCore
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptProfile_h
#define ScriptProfile_h
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include <profiler/Profile.h>
namespace WebCore {
typedef JSC::Profile ScriptProfile;
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
#endif // ScriptProfile_h
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include "ScriptProfiler.h"
#include <profiler/Profiler.h>
namespace WebCore {
void ScriptProfiler::start(ScriptState* state, const String& title)
{
JSC::Profiler::profiler()->startProfiling(state, title);
}
PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
{
return JSC::Profiler::profiler()->stopProfiling(state, title);
}
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptProfiler_h
#define ScriptProfiler_h
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include "ScriptProfile.h"
#include "ScriptState.h"
#include <wtf/Noncopyable.h>
namespace WebCore {
class ScriptProfiler : public Noncopyable {
public:
static void start(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
};
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
#endif // ScriptProfiler_h
......@@ -2056,7 +2056,6 @@ sub HasCustomToV8Implementation {
return 1 if $interfaceName eq "BarInfo";
return 1 if $interfaceName eq "CSSStyleSheet";
return 1 if $interfaceName eq "CanvasPixelArray";
return 1 if $interfaceName eq "Console";
return 1 if $interfaceName eq "DOMSelection";
return 1 if $interfaceName eq "DOMWindow";
return 1 if $interfaceName eq "Element";
......
/*
* Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptProfile_h
#define ScriptProfile_h
#include "PlatformString.h"
namespace WebCore {
class ScriptProfile : public RefCounted<ScriptProfile> {
public:
static PassRefPtr<ScriptProfile> create(const String& title, unsigned uid)
{
return adoptRef(new ScriptProfile(title, uid));
}
virtual ~ScriptProfile() {}
String title() const { return m_title; }
unsigned int uid() const { return m_uid; }
protected:
ScriptProfile(const String& title, unsigned uid)
: m_title(title)
, m_uid(uid)
{}
private:
String m_title;
unsigned int m_uid;
};
} // namespace WebCore
#endif // ScriptProfile_h
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......@@ -29,42 +29,22 @@
*/
#include "config.h"
#include "V8Console.h"
#include "V8Binding.h"
#include "V8DOMWindow.h"
#include "V8Proxy.h"
#include <v8.h>
#include "ScriptProfiler.h"
namespace WebCore {
v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args)
void ScriptProfiler::start(ScriptState* state, const String& title)
{
INC_STATS("console.profile()");
v8::HandleScope scope;
v8::Context::Scope context_scope(v8::Context::GetCurrent());
v8::Context::Scope contextScope(v8::Context::GetCurrent());
v8::V8::ResumeProfiler();
return v8::Undefined();
}
v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args)
PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
{
INC_STATS("console.profileEnd()");
v8::V8::PauseProfiler();
return v8::Undefined();
}
v8::Handle<v8::Value> toV8(Console* impl)
{
if (!impl)
return v8::Null();
v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (wrapper.IsEmpty()) {
wrapper = V8Console::wrap(impl);
if (!wrapper.IsEmpty())
V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::consoleIndex, wrapper);
}
return wrapper;
return 0;
}
} // namespace WebCore
/*
* Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptProfiler_h
#define ScriptProfiler_h
#include "PlatformString.h"
#include "ScriptProfile.h"
#include "ScriptState.h"
#include <wtf/Noncopyable.h>
namespace WebCore {
class ScriptProfiler : public Noncopyable {
public:
static void start(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
};
} // namespace WebCore
#endif // ScriptProfiler_h
......@@ -39,9 +39,9 @@
#include "ConsoleMessage.h"
#include "Cookie.h"
#include "CookieJar.h"
#include "DOMWindow.h"
#include "Document.h"
#include "DocumentLoader.h"
#include "DOMWindow.h"
#include "Element.h"
#include "FloatConversion.h"
#include "FloatQuad.h"
......@@ -53,16 +53,16 @@
#include "GraphicsContext.h"
#include "HTMLFrameOwnerElement.h"
#include "HitTestResult.h"
#include "InspectorBackend.h"
#include "InjectedScriptHost.h"
#include "InspectorBackend.h"
#include "InspectorClient.h"
#include "InspectorFrontend.h"
#include "InspectorFrontendHost.h"
#include "InspectorDatabaseResource.h"
#include "InspectorDOMAgent.h"
#include "InspectorDOMStorageResource.h"
#include "InspectorTimelineAgent.h"
#include "InspectorDatabaseResource.h"
#include "InspectorFrontend.h"
#include "InspectorFrontendHost.h"
#include "InspectorResource.h"
#include "InspectorTimelineAgent.h"
#include "JavaScriptProfile.h"
#include "Page.h"
#include "ProgressTracker.h"
......@@ -73,6 +73,8 @@
#include "ScriptCallStack.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
#include "ScriptProfile.h"
#include "ScriptProfiler.h"
#include "ScriptString.h"
#include "SecurityOrigin.h"
#include "Settings.h"
......@@ -94,14 +96,11 @@
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include "JSJavaScriptCallFrame.h"
#include "JavaScriptCallFrame.h"
#include "JavaScriptDebugServer.h"
#include "JSJavaScriptCallFrame.h"
#include <profiler/Profile.h>
#include <profiler/Profiler.h>
#include <runtime/JSLock.h>
#include <runtime/StringBuilder.h>
#include <runtime/UString.h>
using namespace JSC;
......@@ -390,7 +389,7 @@ void InspectorController::startGroup(MessageSource source, ScriptCallStack* call
void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL)
{
if (m_groupLevel == 0)
if (!m_groupLevel)
return;
--m_groupLevel;
......@@ -558,7 +557,7 @@ void InspectorController::show()
if (!m_page) {
if (m_frontend)
return; // We are using custom frontend - no need to create page.
return; // We are using custom frontend - no need to create page.
m_page = m_client->createPage();
if (!m_page)
......@@ -1306,7 +1305,7 @@ void InspectorController::setDOMStorageItem(long callId, long storageId, const S
if (storageResource) {
ExceptionCode exception = 0;
storageResource->domStorage()->setItem(key, value, exception);
success = (exception == 0);
success = !exception;
}
m_frontend->didSetDOMStorageItem(callId, success);
}
......@@ -1345,12 +1344,12 @@ void InspectorController::moveWindowBy(float x, float y) const
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorController::addProfile(PassRefPtr<Profile> prpProfile, unsigned lineNumber, const UString& sourceURL)
void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
{
if (!enabled())
return;
RefPtr<Profile> profile = prpProfile;
RefPtr<ScriptProfile> profile = prpProfile;
m_profiles.add(profile->uid(), profile);
if (m_frontend) {
......@@ -1361,30 +1360,18 @@ void InspectorController::addProfile(PassRefPtr<Profile> prpProfile, unsigned li
addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL);
}
void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<Profile> prpProfile, unsigned lineNumber, const UString& sourceURL)
void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
{
RefPtr<Profile> profile = prpProfile;
RefPtr<ScriptProfile> profile = prpProfile;
JSC::StringBuilder message;
message.append("Profile \"webkit-profile://");
message.append((UString)encodeWithURLEscapeSequences(CPUProfileType));
message.append("/");
message.append((UString)encodeWithURLEscapeSequences(profile->title()));
message.append("#");
message.append(UString::from(profile->uid()));
message.append("\" finished.");
addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message.release(), lineNumber, sourceURL);
String message = String::format("Profile \"webkit-profile://%s/%s#%d\" finished.", CPUProfileType, encodeWithURLEscapeSequences(profile->title()).utf8().data(), profile->uid());
addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
void InspectorController::addStartProfilingMessageToConsole(const UString& title, unsigned lineNumber, const UString& sourceURL)
void InspectorController::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
{
JSC::StringBuilder message;
message.append("Profile \"webkit-profile://");
message.append(encodeWithURLEscapeSequences(CPUProfileType));