提交 e962904c 编写于 作者: A Adam Barth

Remove TRACE_EVENT indirection through blink::Platform

Normal trace events already go directly to base. This CL removes the remaining
trace events that were still indirected through blink::Platform. These were
just the half-finished inspector timeline trace events, which currently aren't
actually hooked up to anything.

This CL also removes the redunant "convertable to trace format" wrappers and
moves their one remaining use over to just using the version in base directly.

R=eseidel@google.com, ojan@chromium.org

Review URL: https://codereview.chromium.org/889823002
上级 65a50f6c
......@@ -56,7 +56,6 @@
#include "sky/engine/core/html/imports/HTMLImportChild.h"
#include "sky/engine/core/html/imports/HTMLImportLoader.h"
#include "sky/engine/core/html/parser/HTMLDocumentParser.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/platform/NotImplemented.h"
#include "sky/engine/platform/TraceEvent.h"
......@@ -112,17 +111,11 @@ v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v8::Handle<v8::Function> function, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[], v8::Isolate* isolate)
{
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(context, function, isolate));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
return V8ScriptRunner::callFunction(function, context, receiver, argc, info, isolate);
}
v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8::Context> context, const ScriptSourceCode& source)
{
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript", "data", InspectorEvaluateScriptEvent::data(source.url().string(), source.startLine()));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
v8::Local<v8::Value> result;
{
V8CacheOptions v8CacheOptions(V8CacheOptionsOff);
......@@ -144,8 +137,6 @@ v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8
ASSERT(!tryCatch.HasCaught() || result.IsEmpty());
}
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
return result;
}
......
......@@ -43,9 +43,7 @@
#include "sky/engine/core/dom/QualifiedName.h"
#include "sky/engine/core/frame/LocalFrame.h"
#include "sky/engine/core/frame/Settings.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/platform/EventTracer.h"
#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/wtf/ArrayBufferContents.h"
#include "sky/engine/wtf/MainThread.h"
......@@ -836,28 +834,4 @@ v8::Isolate* V8TestingScope::isolate() const
return m_scriptState->isolate();
}
void GetDevToolsFunctionInfo(v8::Handle<v8::Function> function, v8::Isolate* isolate, int& scriptId, String& resourceName, int& lineNumber)
{
v8::Handle<v8::Function> originalFunction = getBoundFunction(function);
scriptId = originalFunction->ScriptId();
v8::ScriptOrigin origin = originalFunction->GetScriptOrigin();
if (!origin.ResourceName().IsEmpty()) {
resourceName = NativeValueTraits<String>::nativeValue(origin.ResourceName(), isolate);
lineNumber = originalFunction->GetScriptLineNumber() + 1;
}
if (resourceName.isEmpty()) {
resourceName = "undefined";
lineNumber = 1;
}
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(ExecutionContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
{
int scriptId = 0;
String resourceName;
int lineNumber = 1;
GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumber);
return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lineNumber);
}
} // namespace blink
......@@ -746,9 +746,6 @@ private:
RefPtr<ScriptState> m_scriptState;
};
void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& scriptId, String& resourceName, int& lineNumber);
PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(ExecutionContext*, v8::Handle<v8::Function>, v8::Isolate*);
class V8RethrowTryCatchScope final {
public:
explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { }
......
......@@ -48,7 +48,6 @@
#include "sky/engine/core/html/HTMLImageElement.h"
#include "sky/engine/core/html/HTMLTemplateElement.h"
#include "sky/engine/core/html/imports/HTMLImportsController.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/platform/Partitions.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/wtf/Vector.h"
......@@ -303,18 +302,10 @@ private:
bool m_constructRetainedObjectInfos;
};
static unsigned long long usedHeapSize(v8::Isolate* isolate)
{
v8::HeapStatistics heapStatistics;
isolate->GetHeapStatistics(&heapStatistics);
return heapStatistics.used_heap_size();
}
void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags)
{
// FIXME: It would be nice if the GC callbacks passed the Isolate directly....
v8::Isolate* isolate = v8::Isolate::GetCurrent();
TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent", "usedHeapSizeBefore", usedHeapSize(isolate));
if (type == v8::kGCTypeScavenge)
minorGCPrologue(isolate);
else if (type == v8::kGCTypeMarkSweepCompact)
......@@ -368,9 +359,6 @@ void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags)
minorGCEpilogue(isolate);
else if (type == v8::kGCTypeMarkSweepCompact)
majorGCEpilogue(isolate);
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent", "usedHeapSizeAfter", usedHeapSize(isolate));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
}
void V8GCController::minorGCEpilogue(v8::Isolate* isolate)
......
......@@ -41,7 +41,6 @@
#include "gen/sky/platform/FontFamilyNames.h"
#include "sky/engine/core/dom/Document.h"
#include "sky/engine/core/html/parser/HTMLParserThread.h"
#include "sky/engine/platform/EventTracer.h"
#include "sky/engine/platform/Partitions.h"
#include "sky/engine/platform/PlatformThreadData.h"
#include "sky/engine/wtf/text/StringStatics.h"
......
......@@ -948,8 +948,6 @@ sky_core_files = [
"inspector/InspectorCounters.h",
"inspector/InspectorNodeIds.cpp",
"inspector/InspectorNodeIds.h",
"inspector/InspectorTraceEvents.cpp",
"inspector/InspectorTraceEvents.h",
"inspector/JavaScriptCallFrame.cpp",
"inspector/JavaScriptCallFrame.h",
"inspector/ScriptArguments.cpp",
......
......@@ -109,7 +109,6 @@
#include "sky/engine/core/html/parser/TextResourceDecoder.h"
#include "sky/engine/core/inspector/ConsoleMessage.h"
#include "sky/engine/core/inspector/InspectorCounters.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/core/loader/ImageLoader.h"
#include "sky/engine/core/page/ChromeClient.h"
......@@ -933,9 +932,6 @@ void Document::scheduleRenderTreeUpdate()
// TODO(esprehn): We should either rename this state, or change the other
// users of scheduleVisualUpdate() so they don't expect different states.
m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScheduleStyleRecalculation", TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
}
void Document::scheduleVisualUpdate()
......@@ -1008,8 +1004,6 @@ void Document::updateRenderTree(StyleRecalcChange change)
TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree");
m_styleRecalcElementCounter = 0;
TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "RecalculateStyles", "frame", frame());
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
DocumentAnimations::updateOutdatedAnimationPlayersIfNeeded(*this);
evaluateMediaQueryListIfNeeded();
......@@ -1028,9 +1022,6 @@ void Document::updateRenderTree(StyleRecalcChange change)
clearFocusedElementSoon();
ASSERT(!m_timeline->hasOutdatedAnimationPlayer());
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "RecalculateStyles", "elementCount", m_styleRecalcElementCounter);
TRACE_EVENT_END1("blink", "Document::updateRenderTree", "elementCount", m_styleRecalcElementCounter);
}
void Document::updateStyle(StyleRecalcChange change)
......@@ -2053,10 +2044,8 @@ void Document::finishedParsing()
// Keep it alive until we are done.
RefPtr<Document> protect(this);
if (RefPtr<LocalFrame> f = frame()) {
if (RefPtr<LocalFrame> f = frame())
checkCompleted();
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "MarkDOMContent", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorMarkLoadEvent::data());
}
// Schedule dropping of the ElementDataCache. We keep it alive for a while after parsing finishes
// so that dynamically inserted content can also benefit from sharing optimizations.
......
......@@ -25,6 +25,7 @@
#include "sky/engine/config.h"
#include "sky/engine/core/dom/Node.h"
#include "base/trace_event/trace_event_impl.h"
#include "gen/sky/core/HTMLNames.h"
#include "sky/engine/bindings/core/v8/DOMDataStore.h"
#include "sky/engine/bindings/core/v8/ExceptionState.h"
......@@ -70,9 +71,9 @@
#include "sky/engine/core/page/Page.h"
#include "sky/engine/core/rendering/RenderBox.h"
#include "sky/engine/platform/EventDispatchForbiddenScope.h"
#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/platform/Partitions.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/platform/TracedValue.h"
#include "sky/engine/wtf/HashSet.h"
#include "sky/engine/wtf/PassOwnPtr.h"
#include "sky/engine/wtf/RefCountedLeakCounter.h"
......@@ -467,7 +468,21 @@ void Node::markAncestorsWithChildNeedsDistributionRecalc()
namespace {
void addJsStack(TracedValue* stackFrames)
class JSONTraceValue : public base::debug::ConvertableToTraceFormat {
public:
explicit JSONTraceValue(RefPtr<JSONValue> value)
: m_value(value.release()) { }
void AppendAsTraceFormat(std::string* out) const override
{
out->append(m_value->toJSONString().utf8().data());
}
private:
RefPtr<JSONValue> m_value;
};
void addJsStack(JSONArray* stackFrames)
{
RefPtr<ScriptCallStack> stack = createScriptCallStack(10);
if (!stack)
......@@ -476,18 +491,18 @@ void addJsStack(TracedValue* stackFrames)
stackFrames->pushString(stack->at(i).functionName());
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForStyleInvalidation(unsigned nodeCount, const Node* rootNode)
scoped_refptr<base::debug::ConvertableToTraceFormat> jsonObjectForStyleInvalidation(unsigned nodeCount, const Node* rootNode)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("node_count", nodeCount);
RefPtr<JSONObject> value = JSONObject::create();
value->setNumber("node_count", nodeCount);
value->setString("root_node", rootNode->debugName());
value->beginArray("js_stack");
addJsStack(value.get());
value->endArray();
return value;
RefPtr<JSONArray> stack;
addJsStack(stack.get());
value->setArray("js_stack", stack.release());
return make_scoped_refptr(new JSONTraceValue(value));
}
} // anonymous namespace'd functions supporting traceStyleChange
} // namespace
unsigned Node::styledSubtreeSize() const
{
......
......@@ -32,7 +32,6 @@
#include "sky/engine/core/events/Event.h"
#include "sky/engine/core/frame/FrameView.h"
#include "sky/engine/core/frame/LocalDOMWindow.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/page/Page.h"
#include "sky/engine/platform/Logging.h"
......@@ -78,10 +77,6 @@ ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCal
callback->m_id = id;
m_callbacks.append(callback);
scheduleAnimationIfNeeded();
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "RequestAnimationFrame", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorAnimationFrameEvent::data(m_document, id));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
return id;
}
......@@ -90,16 +85,12 @@ void ScriptedAnimationController::cancelCallback(CallbackId id)
WTF_LOG(ScriptedAnimationController, "cancelCallback: id = %d", id);
for (size_t i = 0; i < m_callbacks.size(); ++i) {
if (m_callbacks[i]->m_id == id) {
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "CancelAnimationFrame", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorAnimationFrameEvent::data(m_document, id));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
m_callbacks.remove(i);
return;
}
}
for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) {
if (m_callbacksToInvoke[i]->m_id == id) {
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "CancelAnimationFrame", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorAnimationFrameEvent::data(m_document, id));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
m_callbacksToInvoke[i]->m_cancelled = true;
// will be removed at the end of executeCallbacks()
return;
......
......@@ -35,7 +35,6 @@
#include "sky/engine/core/events/WindowEventContext.h"
#include "sky/engine/core/frame/FrameView.h"
#include "sky/engine/core/frame/LocalDOMWindow.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/platform/EventDispatchForbiddenScope.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/wtf/RefPtr.h"
......@@ -86,7 +85,6 @@ bool EventDispatcher::dispatch()
ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());
ASSERT(m_event->target());
WindowEventContext windowEventContext(m_event.get(), m_node.get(), topNodeEventContext());
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EventDispatch", "data", InspectorEventDispatchEvent::data(*m_event));
if (dispatchEventPreProcess() == ContinueDispatching)
if (dispatchEventAtCapturing(windowEventContext) == ContinueDispatching)
......@@ -98,7 +96,6 @@ bool EventDispatcher::dispatch()
// outermost shadow DOM boundary.
m_event->setTarget(windowEventContext.target());
m_event->setCurrentTarget(0);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
return !m_event->defaultPrevented();
}
......
......@@ -31,7 +31,6 @@
#include "sky/engine/bindings/core/v8/ScriptCallStackFactory.h"
#include "sky/engine/core/inspector/ConsoleMessage.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/inspector/ScriptArguments.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/wtf/text/CString.h"
......@@ -171,7 +170,6 @@ void ConsoleBase::timeEnd(ScriptState* scriptState, const String& title)
void ConsoleBase::timeStamp(const String& title)
{
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimeStamp", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorTimeStampEvent::data(context(), title));
}
void ConsoleBase::timeline(ScriptState* scriptState, const String& title)
......
......@@ -28,7 +28,6 @@
#include "sky/engine/core/frame/DOMTimer.h"
#include "sky/engine/core/dom/ExecutionContext.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/platform/Logging.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/wtf/CurrentTime.h"
......@@ -62,8 +61,6 @@ double DOMTimer::visiblePageAlignmentInterval()
int DOMTimer::install(ExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
{
int timeoutID = context->installNewTimeout(action, timeout, singleShot);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerInstall", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, singleShot));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
WTF_LOG(Timers, "DOMTimer::install: timeoutID = %d, timeout = %d, singleShot = %d", timeoutID, timeout, singleShot ? 1 : 0);
return timeoutID;
}
......@@ -72,8 +69,6 @@ void DOMTimer::removeByID(ExecutionContext* context, int timeoutID)
{
WTF_LOG(Timers, "DOMTimer::removeByID: timeoutID = %d", timeoutID);
context->removeTimeoutByID(timeoutID);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerRemove", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorTimerRemoveEvent::data(context, timeoutID));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
}
DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action, int interval, bool singleShot, int timeoutID)
......@@ -108,8 +103,6 @@ void DOMTimer::fired()
timerNestingLevel = m_nestingLevel;
ASSERT(!context->activeDOMObjectsAreSuspended());
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID));
// Simple case for non-one-shot timers.
if (isActive()) {
if (repeatInterval() && repeatInterval() < minimumInterval) {
......@@ -135,8 +128,6 @@ void DOMTimer::fired()
action->execute(context);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
timerNestingLevel = 0;
}
......
......@@ -38,7 +38,6 @@
#include "sky/engine/core/frame/LocalFrame.h"
#include "sky/engine/core/frame/Settings.h"
#include "sky/engine/core/html/parser/TextResourceDecoder.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/core/page/ChromeClient.h"
#include "sky/engine/core/page/EventHandler.h"
......@@ -287,9 +286,6 @@ void FrameView::layout(bool allowSubtree)
RELEASE_ASSERT(!isPainting());
TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
if (!allowSubtree && isSubtreeLayout()) {
m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
m_layoutSubtreeRoot = 0;
......@@ -343,8 +339,6 @@ void FrameView::layout(bool allowSubtree)
scheduleOrPerformPostLayoutTasks();
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "endData", InspectorLayoutEvent::endData(rootForThisLayout));
m_nestedLayoutCount--;
if (m_nestedLayoutCount)
return;
......@@ -419,8 +413,6 @@ void FrameView::scheduleRelayout()
return;
if (!m_frame->document()->isActive())
return;
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "InvalidateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get());
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
if (m_hasPendingLayout)
return;
......@@ -480,8 +472,6 @@ void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
m_frame->document()->scheduleVisualUpdate();
lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean);
}
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "InvalidateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get());
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
}
bool FrameView::layoutPending() const
......@@ -683,9 +673,6 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
RELEASE_ASSERT(!needsLayout());
ASSERT(m_frame->document()->lifecycle().state() >= DocumentLifecycle::StyleAndLayoutClean);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data", InspectorPaintEvent::data(renderView, rect));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
bool isTopLevelPainter = !s_inPaintContents;
s_inPaintContents = true;
......@@ -726,10 +713,8 @@ void FrameView::updateLayoutAndStyleForPainting()
updateLayoutAndStyleIfNeededRecursive();
if (RenderView* view = renderView()) {
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "updateIFramesAfterLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get());
if (RenderView* view = renderView())
view->updateIFramesAfterLayout();
}
// TODO(ojan): Get rid of this and just have the LayoutClean state.
lifecycle().advanceTo(DocumentLifecycle::StyleAndLayoutClean);
......
......@@ -63,7 +63,6 @@
#include "sky/engine/core/frame/Settings.h"
#include "sky/engine/core/inspector/ConsoleMessage.h"
#include "sky/engine/core/inspector/ConsoleMessageStorage.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/core/page/ChromeClient.h"
#include "sky/engine/core/page/EventHandler.h"
......@@ -662,8 +661,6 @@ void LocalDOMWindow::dispatchLoadEvent()
{
RefPtr<Event> loadEvent(Event::create(EventTypeNames::load));
dispatchEvent(loadEvent, document());
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "MarkLoad", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorMarkLoadEvent::data());
}
bool LocalDOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget)
......@@ -677,8 +674,6 @@ bool LocalDOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventT
event->setCurrentTarget(this);
event->setEventPhase(Event::AT_TARGET);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EventDispatch", "data", InspectorEventDispatchEvent::data(*event));
bool result = fireEventListeners(event.get());
return result;
......
......@@ -37,7 +37,6 @@
#include "sky/engine/core/html/parser/HTMLParserScheduler.h"
#include "sky/engine/core/html/parser/HTMLParserThread.h"
#include "sky/engine/core/html/parser/HTMLTreeBuilder.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/platform/SharedBuffer.h"
#include "sky/engine/platform/TraceEvent.h"
......@@ -240,10 +239,6 @@ void HTMLDocumentParser::pumpPendingSpeculations()
ASSERT(!isWaitingForScripts());
ASSERT(!isStopped());
// FIXME: Pass in current input length.
TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt()));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
double startTime = currentTime();
while (!m_speculations.isEmpty()) {
......@@ -258,9 +253,6 @@ void HTMLDocumentParser::pumpPendingSpeculations()
break;
}
}
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML", "endLine", lineNumber().zeroBasedInt());
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
}
Document* HTMLDocumentParser::contextForParsingSession()
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/config.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/bindings/core/v8/ScriptCallStackFactory.h"
#include "sky/engine/bindings/core/v8/ScriptGCEvent.h"
#include "sky/engine/bindings/core/v8/ScriptSourceCode.h"
#include "sky/engine/core/events/Event.h"
#include "sky/engine/core/frame/FrameView.h"
#include "sky/engine/core/frame/LocalDOMWindow.h"
#include "sky/engine/core/inspector/IdentifiersFactory.h"
#include "sky/engine/core/inspector/InspectorNodeIds.h"
#include "sky/engine/core/inspector/ScriptCallStack.h"
#include "sky/engine/core/page/Page.h"
#include "sky/engine/core/rendering/RenderImage.h"
#include "sky/engine/core/rendering/RenderObject.h"
#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/platform/network/ResourceRequest.h"
#include "sky/engine/platform/network/ResourceResponse.h"
#include "sky/engine/platform/TracedValue.h"
#include "sky/engine/platform/weborigin/KURL.h"
#include "sky/engine/wtf/Vector.h"
namespace blink {
namespace {
class JSCallStack : public TraceEvent::ConvertableToTraceFormat {
public:
explicit JSCallStack(PassRefPtr<ScriptCallStack> callstack)
{
ASSERT(m_serialized.isSafeToSendToAnotherThread());
}
virtual String asTraceFormat() const
{
return m_serialized;
}
private:
String m_serialized;
};
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData(FrameView* frameView)
{
bool isPartial;
unsigned needsLayoutObjects;
unsigned totalObjects;
frameView->countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial);
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("dirtyObjects", needsLayoutObjects);
value->setInteger("totalObjects", totalObjects);
value->setBoolean("partialLayout", isPartial);
return value;
}
static void createQuad(TracedValue* value, const char* name, const FloatQuad& quad)
{
value->beginArray(name);
value->pushDouble(quad.p1().x());
value->pushDouble(quad.p1().y());
value->pushDouble(quad.p2().x());
value->pushDouble(quad.p2().y());
value->pushDouble(quad.p3().x());
value->pushDouble(quad.p3().y());
value->pushDouble(quad.p4().x());
value->pushDouble(quad.p4().y());
value->endArray();
}
static void setGeneratingNodeId(TracedValue* value, const char* fieldName, const RenderObject* renderer)
{
Node* node = 0;
for (; renderer && !node; renderer = renderer->parent())
node = renderer->node();
if (!node)
return;
value->setInteger(fieldName, InspectorNodeIds::idForNode(node));
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::endData(RenderObject* rootForThisLayout)
{
Vector<FloatQuad> quads;
rootForThisLayout->absoluteQuads(quads);
RefPtr<TracedValue> value = TracedValue::create();
if (quads.size() >= 1) {
createQuad(value.get(), "root", quads[0]);
setGeneratingNodeId(value.get(), "rootNode", rootForThisLayout);
} else {
ASSERT_NOT_REACHED();
}
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorSendRequestEvent::data(unsigned long identifier, const ResourceRequest& request)
{
String requestId = IdentifiersFactory::requestId(identifier);
RefPtr<TracedValue> value = TracedValue::create();
value->setString("requestId", requestId);
value->setString("url", request.url().string());
value->setString("requestMethod", request.httpMethod());
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorReceiveResponseEvent::data(unsigned long identifier, const ResourceResponse& response)
{
String requestId = IdentifiersFactory::requestId(identifier);
RefPtr<TracedValue> value = TracedValue::create();
value->setString("requestId", requestId);
value->setInteger("statusCode", response.httpStatusCode());
value->setString("mimeType", response.mimeType().string().isolatedCopy());
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorReceiveDataEvent::data(unsigned long identifier, int encodedDataLength)
{
String requestId = IdentifiersFactory::requestId(identifier);
RefPtr<TracedValue> value = TracedValue::create();
value->setString("requestId", requestId);
value->setInteger("encodedDataLength", encodedDataLength);
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorResourceFinishEvent::data(unsigned long identifier, double finishTime, bool didFail)
{
String requestId = IdentifiersFactory::requestId(identifier);
RefPtr<TracedValue> value = TracedValue::create();
value->setString("requestId", requestId);
value->setBoolean("didFail", didFail);
if (finishTime)
value->setDouble("networkTime", finishTime);
return value;
}
static PassRefPtr<TracedValue> genericTimerData(ExecutionContext* context, int timerId)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("timerId", timerId);
return value.release();
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTimerInstallEvent::data(ExecutionContext* context, int timerId, int timeout, bool singleShot)
{
RefPtr<TracedValue> value = genericTimerData(context, timerId);
value->setInteger("timeout", timeout);
value->setBoolean("singleShot", singleShot);
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTimerRemoveEvent::data(ExecutionContext* context, int timerId)
{
return genericTimerData(context, timerId);
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTimerFireEvent::data(ExecutionContext* context, int timerId)
{
return genericTimerData(context, timerId);
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorAnimationFrameEvent::data(Document* document, int callbackId)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("id", callbackId);
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorParseHtmlEvent::beginData(Document* document, unsigned startLine)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("startLine", startLine);
return value;
}
static void localToPageQuad(const RenderObject& renderer, const LayoutRect& rect, FloatQuad* quad)
{
FloatQuad absolute = renderer.localToAbsoluteQuad(FloatQuad(rect));
quad->setP1(roundedIntPoint(absolute.p1()));
quad->setP2(roundedIntPoint(absolute.p2()));
quad->setP3(roundedIntPoint(absolute.p3()));
quad->setP4(roundedIntPoint(absolute.p4()));
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorPaintEvent::data(RenderObject* renderer, const LayoutRect& clipRect)
{
RefPtr<TracedValue> value = TracedValue::create();
FloatQuad quad;
localToPageQuad(*renderer, clipRect, &quad);
createQuad(value.get(), "clip", quad);
setGeneratingNodeId(value.get(), "nodeId", renderer);
value->setInteger("layerId", 0);
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorMarkLoadEvent::data()
{
return TracedValue::create();
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorEvaluateScriptEvent::data(const String& url, int lineNumber)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setString("url", url);
value->setInteger("lineNumber", lineNumber);
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorFunctionCallEvent::data(ExecutionContext* context, int scriptId, const String& scriptName, int scriptLine)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setString("scriptId", String::number(scriptId));
value->setString("scriptName", scriptName);
value->setInteger("scriptLine", scriptLine);
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorPaintImageEvent::data(const RenderImage& renderImage)
{
RefPtr<TracedValue> value = TracedValue::create();
setGeneratingNodeId(value.get(), "nodeId", &renderImage);
if (const ImageResource* resource = renderImage.cachedImage())
value->setString("url", resource->url().string());
return value;
}
static size_t usedHeapSize()
{
HeapInfo info;
ScriptGCEvent::getHeapSize(info);
return info.usedJSHeapSize;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorUpdateCountersEvent::data()
{
RefPtr<TracedValue> value = TracedValue::create();
if (isMainThread()) {
value->setInteger("documents", InspectorCounters::counterValue(InspectorCounters::DocumentCounter));
value->setInteger("nodes", InspectorCounters::counterValue(InspectorCounters::NodeCounter));
value->setInteger("jsEventListeners", InspectorCounters::counterValue(InspectorCounters::JSEventListenerCounter));
}
value->setDouble("jsHeapSizeUsed", static_cast<double>(usedHeapSize()));
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorCallStackEvent::currentCallStack()
{
return adoptRef(new JSCallStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true)));
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorEventDispatchEvent::data(const Event& event)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setString("type", event.type());
return value;
}
PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTimeStampEvent::data(ExecutionContext* context, const String& message)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setString("message", message);
return value;
}
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_CORE_INSPECTOR_INSPECTORTRACEEVENTS_H_
#define SKY_ENGINE_CORE_INSPECTOR_INSPECTORTRACEEVENTS_H_
#include "sky/engine/platform/EventTracer.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/wtf/Forward.h"
namespace blink {
class Document;
class Event;
class ExecutionContext;
class FrameView;
class GraphicsContext;
class KURL;
class LayoutRect;
class RenderObject;
class RenderImage;
class ResourceRequest;
class ResourceResponse;
class ScriptSourceCode;
class ScriptCallStack;
class InspectorLayoutEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> beginData(FrameView*);
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> endData(RenderObject* rootForThisLayout);
};
class InspectorSendRequestEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(unsigned long identifier, const ResourceRequest&);
};
class InspectorReceiveResponseEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(unsigned long identifier, const ResourceResponse&);
};
class InspectorReceiveDataEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(unsigned long identifier, int encodedDataLength);
};
class InspectorResourceFinishEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(unsigned long identifier, double finishTime, bool didFail);
};
class InspectorTimerInstallEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(ExecutionContext*, int timerId, int timeout, bool singleShot);
};
class InspectorTimerRemoveEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(ExecutionContext*, int timerId);
};
class InspectorTimerFireEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(ExecutionContext*, int timerId);
};
class InspectorAnimationFrameEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(Document*, int callbackId);
};
class InspectorParseHtmlEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> beginData(Document*, unsigned startLine);
};
class InspectorPaintEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(RenderObject*, const LayoutRect& clipRect);
};
class InspectorPaintImageEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(const RenderImage&);
};
class InspectorMarkLoadEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data();
};
class InspectorEvaluateScriptEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(const String& url, int lineNumber);
};
class InspectorFunctionCallEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(ExecutionContext*, int scriptId, const String& scriptName, int scriptLine);
};
class InspectorUpdateCountersEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data();
};
class InspectorCallStackEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> currentCallStack();
};
class InspectorEventDispatchEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(const Event&);
};
class InspectorTimeStampEvent {
public:
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(ExecutionContext*, const String& message);
};
} // namespace blink
#endif // SKY_ENGINE_CORE_INSPECTOR_INSPECTORTRACEEVENTS_H_
......@@ -34,7 +34,6 @@
#include "sky/engine/core/dom/Document.h"
#include "sky/engine/core/frame/FrameConsole.h"
#include "sky/engine/core/frame/LocalFrame.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/core/page/Page.h"
......@@ -68,8 +67,6 @@ void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
void FrameFetchContext::dispatchWillSendRequest(Document* document, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& initiatorInfo)
{
m_frame->loaderClient()->dispatchWillSendRequest(document, identifier, request, redirectResponse);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResourceSendRequest", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorSendRequestEvent::data(identifier, request));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
}
void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceRequest& request, const ResourceResponse& response)
......@@ -80,29 +77,24 @@ void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq
void FrameFetchContext::dispatchDidReceiveResponse(Document* document, unsigned long identifier, const ResourceResponse& r, ResourceLoader* resourceLoader)
{
m_frame->loaderClient()->dispatchDidReceiveResponse(document, identifier, r);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResourceReceiveResponse", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorReceiveResponseEvent::data(identifier, r));
m_frame->console().reportResourceResponseReceived(document, identifier, r);
}
void FrameFetchContext::dispatchDidReceiveData(Document*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
{
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResourceReceivedData", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorReceiveDataEvent::data(identifier, encodedDataLength));
}
void FrameFetchContext::dispatchDidDownloadData(Document*, unsigned long identifier, int dataLength, int encodedDataLength)
{
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResourceReceivedData", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorReceiveDataEvent::data(identifier, encodedDataLength));
}
void FrameFetchContext::dispatchDidFinishLoading(Document* document, unsigned long identifier, double finishTime, int64_t encodedDataLength)
{
m_frame->loaderClient()->dispatchDidFinishLoading(document, identifier);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResourceFinish", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorResourceFinishEvent::data(identifier, finishTime, false));
}
void FrameFetchContext::dispatchDidFail(Document* document, unsigned long identifier, const ResourceError& error)
{
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResourceFinish", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorResourceFinishEvent::data(identifier, 0, true));
}
void FrameFetchContext::sendRemainingDelegateMessages(Document* document, unsigned long identifier, const ResourceResponse& response, int dataLength)
......
......@@ -34,7 +34,6 @@
#include "sky/engine/core/fetch/ResourceLoader.h"
#include "sky/engine/core/frame/LocalFrame.h"
#include "sky/engine/core/html/HTMLImageElement.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/core/rendering/HitTestResult.h"
#include "sky/engine/core/rendering/PaintInfo.h"
#include "sky/engine/core/rendering/RenderLayer.h"
......@@ -196,7 +195,6 @@ void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect
Image* image = img.get();
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "data", InspectorPaintImageEvent::data(*this));
InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality();
context->setImageInterpolationQuality(InterpolationLow);
context->drawImage(image, alignedRect, CompositeSourceOver, shouldRespectImageOrientation());
......
......@@ -60,7 +60,6 @@
#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/platform/Partitions.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/platform/TracedValue.h"
#include "sky/engine/platform/geometry/TransformState.h"
#include "sky/engine/platform/graphics/GraphicsContext.h"
#include "sky/engine/wtf/RefCountedLeakCounter.h"
......
......@@ -116,15 +116,12 @@ source_set("platform") {
"Decimal.cpp",
"Decimal.h",
"EventDispatchForbiddenScope.h",
"EventTracer.cpp",
"EventTracer.h",
"exported/linux/WebFontInfo.cpp",
"exported/linux/WebFontRenderStyle.cpp",
"exported/Platform.cpp",
"exported/ServiceProvider.cpp",
"exported/WebArrayBuffer.cpp",
"exported/WebCommon.cpp",
"exported/WebConvertableToTraceFormat.cpp",
"exported/WebCString.cpp",
"exported/WebCursorInfo.cpp",
"exported/WebData.cpp",
......@@ -539,8 +536,6 @@ source_set("platform") {
"ThreadTimers.h",
"Timer.cpp",
"Timer.h",
"TracedValue.cpp",
"TracedValue.h",
"TraceEvent.h",
"transforms/AffineTransform.cpp",
"transforms/AffineTransform.h",
......@@ -667,7 +662,6 @@ test("platform_unittests") {
"SharedBufferTest.cpp",
"TestingPlatformSupport.cpp",
"TestingPlatformSupport.h",
"TracedValueTest.cpp",
"animation/TimingFunctionTest.cpp",
"animation/UnitBezierTest.cpp",
"clipboard/ClipboardUtilitiesTest.cpp",
......
/*
* Copyright (C) 2011 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.
*/
#include "sky/engine/config.h"
#include "sky/engine/platform/EventTracer.h"
#include <stdio.h>
#include "sky/engine/public/platform/Platform.h"
#include "sky/engine/public/platform/WebConvertableToTraceFormat.h"
#include "sky/engine/wtf/Assertions.h"
namespace blink {
COMPILE_ASSERT(sizeof(blink::Platform::TraceEventHandle) == sizeof(TraceEvent::TraceEventHandle), TraceEventHandle_types_must_be_compatible);
const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* categoryName)
{
static const char* dummyCategoryEnabledFlag = "*";
// current() might not exist in unit tests.
if (!blink::Platform::current())
return reinterpret_cast<const unsigned char*>(dummyCategoryEnabledFlag);
return blink::Platform::current()->getTraceCategoryEnabledFlag(categoryName);
}
TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag,
const char* name, unsigned long long id, int numArgs, const char* argNames[],
const unsigned char argTypes[], const unsigned long long argValues[],
TraceEvent::ConvertableToTraceFormat* convertableValues[],
unsigned char flags)
{
blink::WebConvertableToTraceFormat webConvertableValues[2];
if (numArgs <= static_cast<int>(WTF_ARRAY_LENGTH(webConvertableValues))) {
for (int i = 0; i < numArgs; ++i) {
if (convertableValues[i])
webConvertableValues[i] = blink::WebConvertableToTraceFormat(convertableValues[i]);
}
} else {
ASSERT_NOT_REACHED();
}
return blink::Platform::current()->addTraceEvent(phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes, argValues, webConvertableValues, flags);
}
TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag,
const char* name, unsigned long long id, int numArgs, const char** argNames,
const unsigned char* argTypes, const unsigned long long* argValues,
unsigned char flags)
{
return blink::Platform::current()->addTraceEvent(phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes, argValues, 0, flags);
}
void EventTracer::updateTraceEventDuration(const unsigned char* categoryEnabledFlag, const char* name, TraceEvent::TraceEventHandle handle)
{
blink::Platform::current()->updateTraceEventDuration(categoryEnabledFlag, name, handle);
}
} // namespace blink
/*
* Copyright (C) 2011 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 SKY_ENGINE_PLATFORM_EVENTTRACER_H_
#define SKY_ENGINE_PLATFORM_EVENTTRACER_H_
#include <stdint.h>
#include "sky/engine/platform/PlatformExport.h"
#include "sky/engine/wtf/RefCounted.h"
#include "sky/engine/wtf/RefPtr.h"
#include "sky/engine/wtf/text/WTFString.h"
namespace blink {
namespace TraceEvent {
typedef uint64_t TraceEventHandle;
class PLATFORM_EXPORT ConvertableToTraceFormat : public RefCounted<ConvertableToTraceFormat> {
public:
virtual String asTraceFormat() const = 0;
virtual ~ConvertableToTraceFormat() { }
};
}
class PLATFORM_EXPORT EventTracer {
public:
static const unsigned char* getTraceCategoryEnabledFlag(const char*);
static TraceEvent::TraceEventHandle addTraceEvent(char phase,
const unsigned char* categoryEnabledFlag,
const char* name,
unsigned long long id,
int numArgs,
const char* argNames[],
const unsigned char argTypes[],
const unsigned long long argValues[],
TraceEvent::ConvertableToTraceFormat*[],
unsigned char flags);
static TraceEvent::TraceEventHandle addTraceEvent(char phase,
const unsigned char* categoryEnabledFlag,
const char* name,
unsigned long long id,
int numArgs,
const char* argNames[],
const unsigned char argTypes[],
const unsigned long long argValues[],
unsigned char flags);
static void updateTraceEventDuration(const unsigned char* categoryEnabledFlag, const char* name, TraceEvent::TraceEventHandle);
};
} // namespace blink
#endif // SKY_ENGINE_PLATFORM_EVENTTRACER_H_
......@@ -80,10 +80,4 @@ blink::WebDiscardableMemory* TestingPlatformSupport::allocateAndLockDiscardableM
return !m_config.hasDiscardableMemorySupport ? 0 : new TestingDiscardableMemory(bytes);
}
const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName)
{
static const unsigned char tracingIsDisabled = 0;
return &tracingIsDisabled;
}
} // namespace blink
......@@ -66,7 +66,6 @@ public:
// Platform:
virtual WebDiscardableMemory* allocateAndLockDiscardableMemory(size_t bytes) override;
virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) override;
private:
const Config m_config;
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/config.h"
#include "sky/engine/platform/TracedValue.h"
#include "sky/engine/platform/JSONValues.h"
namespace blink {
namespace {
String threadSafeCopy(const String& string)
{
RefPtr<StringImpl> copy(string.impl());
if (string.isSafeToSendToAnotherThread())
return string;
return string.isolatedCopy();
}
}
PassRefPtr<TracedValue> TracedValue::create()
{
return adoptRef(new TracedValue());
}
TracedValue::TracedValue()
{
m_stack.append(JSONObject::create());
}
TracedValue::~TracedValue()
{
ASSERT(m_stack.size() == 1);
}
void TracedValue::setInteger(const char* name, int value)
{
currentDictionary()->setNumber(name, value);
}
void TracedValue::setDouble(const char* name, double value)
{
currentDictionary()->setNumber(name, value);
}
void TracedValue::setBoolean(const char* name, bool value)
{
currentDictionary()->setBoolean(name, value);
}
void TracedValue::setString(const char* name, const String& value)
{
currentDictionary()->setString(name, threadSafeCopy(value));
}
void TracedValue::beginDictionary(const char* name)
{
RefPtr<JSONObject> dictionary = JSONObject::create();
currentDictionary()->setObject(name, dictionary);
m_stack.append(dictionary);
}
void TracedValue::beginArray(const char* name)
{
RefPtr<JSONArray> array = JSONArray::create();
currentDictionary()->setArray(name, array);
m_stack.append(array);
}
void TracedValue::endDictionary()
{
ASSERT(m_stack.size() > 1);
ASSERT(currentDictionary());
m_stack.removeLast();
}
void TracedValue::pushInteger(int value)
{
currentArray()->pushInt(value);
}
void TracedValue::pushDouble(double value)
{
currentArray()->pushNumber(value);
}
void TracedValue::pushBoolean(bool value)
{
currentArray()->pushBoolean(value);
}
void TracedValue::pushString(const String& value)
{
currentArray()->pushString(threadSafeCopy(value));
}
void TracedValue::beginArray()
{
RefPtr<JSONArray> array = JSONArray::create();
currentArray()->pushArray(array);
m_stack.append(array);
}
void TracedValue::beginDictionary()
{
RefPtr<JSONObject> dictionary = JSONObject::create();
currentArray()->pushObject(dictionary);
m_stack.append(dictionary);
}
void TracedValue::endArray()
{
ASSERT(m_stack.size() > 1);
ASSERT(currentArray());
m_stack.removeLast();
}
String TracedValue::asTraceFormat() const
{
ASSERT(m_stack.size() == 1);
return m_stack.first()->toJSONString();
}
JSONObject* TracedValue::currentDictionary() const
{
ASSERT(!m_stack.isEmpty());
ASSERT(m_stack.last()->type() == JSONValue::TypeObject);
return static_cast<JSONObject*>(m_stack.last().get());
}
JSONArray* TracedValue::currentArray() const
{
ASSERT(!m_stack.isEmpty());
ASSERT(m_stack.last()->type() == JSONValue::TypeArray);
return static_cast<JSONArray*>(m_stack.last().get());
}
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_PLATFORM_TRACEDVALUE_H_
#define SKY_ENGINE_PLATFORM_TRACEDVALUE_H_
#include "sky/engine/platform/EventTracer.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/text/WTFString.h"
namespace blink {
class JSONArray;
class JSONObject;
class JSONValue;
class PLATFORM_EXPORT TracedValue : public TraceEvent::ConvertableToTraceFormat {
WTF_MAKE_NONCOPYABLE(TracedValue);
public:
static PassRefPtr<TracedValue> create();
void endDictionary();
void endArray();
void setInteger(const char* name, int value);
void setDouble(const char* name, double);
void setBoolean(const char* name, bool value);
void setString(const char* name, const String& value);
void beginArray(const char* name);
void beginDictionary(const char* name);
void pushInteger(int);
void pushDouble(double);
void pushBoolean(bool);
void pushString(const String&);
void beginArray();
void beginDictionary();
virtual String asTraceFormat() const override;
private:
TracedValue();
virtual ~TracedValue();
JSONObject* currentDictionary() const;
JSONArray* currentArray() const;
Vector<RefPtr<JSONValue> > m_stack;
};
} // namespace blink
#endif // SKY_ENGINE_PLATFORM_TRACEDVALUE_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/config.h"
#include "sky/engine/platform/TracedValue.h"
#include <gtest/gtest.h>
using namespace blink;
namespace {
TEST(TracedValueTest, FlatDictionary)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("int", 2014);
value->setDouble("double", 0.0);
value->setBoolean("bool", true);
value->setString("string", "string");
String json = value->asTraceFormat();
EXPECT_EQ("{\"int\":2014,\"double\":0,\"bool\":true,\"string\":\"string\"}", json);
}
TEST(TracedValueTest, Hierarchy)
{
RefPtr<TracedValue> value = TracedValue::create();
value->setInteger("i0", 2014);
value->beginDictionary("dict1");
value->setInteger("i1", 2014);
value->beginDictionary("dict2");
value->setBoolean("b2", false);
value->endDictionary();
value->setString("s1", "foo");
value->endDictionary();
value->setDouble("d0", 0.0);
value->setBoolean("b0", true);
value->beginArray("a1");
value->pushInteger(1);
value->pushBoolean(true);
value->beginDictionary();
value->setInteger("i2", 3);
value->endDictionary();
value->endArray();
value->setString("s0", "foo");
String json = value->asTraceFormat();
EXPECT_EQ("{\"i0\":2014,\"dict1\":{\"i1\":2014,\"dict2\":{\"b2\":false},\"s1\":\"foo\"},\"d0\":0,\"b0\":true,\"a1\":[1,true,{\"i2\":3}],\"s0\":\"foo\"}", json);
}
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/config.h"
#include "sky/engine/public/platform/WebConvertableToTraceFormat.h"
#include "sky/engine/platform/EventTracer.h"
#include "sky/engine/public/platform/WebString.h"
namespace blink {
WebConvertableToTraceFormat::WebConvertableToTraceFormat(TraceEvent::ConvertableToTraceFormat* convertable)
: m_private(convertable)
{
}
WebString WebConvertableToTraceFormat::asTraceFormat() const
{
return m_private->asTraceFormat();
}
void WebConvertableToTraceFormat::assign(const WebConvertableToTraceFormat& r)
{
m_private = r.m_private;
}
void WebConvertableToTraceFormat::reset()
{
m_private.reset();
}
} // namespace blink
......@@ -136,7 +136,6 @@ SkBitmap NativeImageSkia::resizedBitmap(const SkISize& scaledImageSize, const Sk
bool shouldCache = isDataComplete()
&& shouldCacheResampling(scaledImageSize, scaledImageSubset);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResizeImage", "cached", shouldCache);
SkBitmap resizedImage = skia::ImageOperations::Resize(bitmap(), skia::ImageOperations::RESIZE_LANCZOS3, scaledImageSize.width(), scaledImageSize.height(), scaledImageSubset);
resizedImage.setImmutable();
......
......@@ -32,7 +32,6 @@
#include <string.h>
#include "base/test/test_suite.h"
#include "sky/engine/platform/EventTracer.h"
#include "sky/engine/platform/Partitions.h"
#include "sky/engine/platform/TestingPlatformSupport.h"
#include "sky/engine/wtf/CryptographicallyRandomNumber.h"
......
......@@ -24,7 +24,6 @@ source_set("platform_headers") {
"platform/WebCommon.h",
"platform/WebContentLayer.h",
"platform/WebContentLayerClient.h",
"platform/WebConvertableToTraceFormat.h",
"platform/WebCursorInfo.h",
"platform/WebData.h",
"platform/WebDiscardableMemory.h",
......
......@@ -54,7 +54,6 @@ namespace blink {
class WebBlobRegistry;
class WebClipboard;
class WebConvertableToTraceFormat;
class WebDiscardableMemory;
class WebFallbackThemeEngine;
class WebGraphicsContext3DProvider;
......@@ -225,90 +224,6 @@ public:
// Tracing -------------------------------------------------------------
// Get a pointer to the enabled state of the given trace category. The
// embedder can dynamically change the enabled state as trace event
// recording is started and stopped by the application. Only long-lived
// literal strings should be given as the category name. The implementation
// expects the returned pointer to be held permanently in a local static. If
// the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
// addTraceEvent is expected to be called by the trace event macros.
virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) { return 0; }
typedef uint64_t TraceEventHandle;
// Add a trace event to the platform tracing system. Depending on the actual
// enabled state, this event may be recorded or dropped.
// - phase specifies the type of event:
// - BEGIN ('B'): Marks the beginning of a scoped event.
// - END ('E'): Marks the end of a scoped event.
// - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't
// need a matching END event. Instead, at the end of the scope,
// updateTraceEventDuration() must be called with the TraceEventHandle
// returned from addTraceEvent().
// - INSTANT ('I'): Standalone, instantaneous event.
// - START ('S'): Marks the beginning of an asynchronous event (the end
// event can occur in a different scope or thread). The id parameter is
// used to match START/FINISH pairs.
// - FINISH ('F'): Marks the end of an asynchronous event.
// - COUNTER ('C'): Used to trace integer quantities that change over
// time. The argument values are expected to be of type int.
// - METADATA ('M'): Reserved for internal use.
// - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
// - name is the name of the event. Also used to match BEGIN/END and
// START/FINISH pairs.
// - id optionally allows events of the same name to be distinguished from
// each other. For example, to trace the consutruction and destruction of
// objects, specify the pointer as the id parameter.
// - numArgs specifies the number of elements in argNames, argTypes, and
// argValues.
// - argNames is the array of argument names. Use long-lived literal strings
// or specify the COPY flag.
// - argTypes is the array of argument types:
// - BOOL (1): bool
// - UINT (2): unsigned long long
// - INT (3): long long
// - DOUBLE (4): double
// - POINTER (5): void*
// - STRING (6): char* (long-lived null-terminated char* string)
// - COPY_STRING (7): char* (temporary null-terminated char* string)
// - CONVERTABLE (8): WebConvertableToTraceFormat
// - argValues is the array of argument values. Each value is the unsigned
// long long member of a union of all supported types.
// - convertableValues is the array of WebConvertableToTraceFormat classes
// that may be converted to trace format by calling asTraceFormat method.
// ConvertableToTraceFormat interface.
// - thresholdBeginId optionally specifies the value returned by a previous
// call to addTraceEvent with a BEGIN phase.
// - threshold is used on an END phase event in conjunction with the
// thresholdBeginId of a prior BEGIN event. The threshold is the minimum
// number of microseconds that must have passed since the BEGIN event. If
// less than threshold microseconds has passed, the BEGIN/END pair is
// dropped.
// - flags can be 0 or one or more of the following, ORed together:
// - COPY (0x1): treat all strings (name, argNames and argValues of type
// string) as temporary so that they will be copied by addTraceEvent.
// - HAS_ID (0x2): use the id argument to uniquely identify the event for
// matching with other events of the same name.
// - MANGLE_ID (0x4): specify this flag if the id parameter is the value
// of a pointer.
virtual TraceEventHandle addTraceEvent(
char phase,
const unsigned char* categoryEnabledFlag,
const char* name,
unsigned long long id,
int numArgs,
const char** argNames,
const unsigned char* argTypes,
const unsigned long long* argValues,
const WebConvertableToTraceFormat* convertableValues,
unsigned char flags)
{
return 0;
}
// Set the duration field of a COMPLETE trace event.
virtual void updateTraceEventDuration(const unsigned char* categoryEnabledFlag, const char* name, TraceEventHandle) { }
// Callbacks for reporting histogram data.
// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do.
virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { }
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBCONVERTABLETOTRACEFORMAT_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_WEBCONVERTABLETOTRACEFORMAT_H_
#include "sky/engine/public/platform/WebPrivatePtr.h"
#include "sky/engine/public/platform/WebString.h"
namespace blink {
namespace TraceEvent {
class ConvertableToTraceFormat;
}
class WebConvertableToTraceFormat {
public:
WebConvertableToTraceFormat() { }
#if INSIDE_BLINK
WebConvertableToTraceFormat(TraceEvent::ConvertableToTraceFormat*);
#endif
~WebConvertableToTraceFormat() { reset(); }
BLINK_PLATFORM_EXPORT WebString asTraceFormat() const;
BLINK_PLATFORM_EXPORT void assign(const WebConvertableToTraceFormat&);
BLINK_PLATFORM_EXPORT void reset();
WebConvertableToTraceFormat(const WebConvertableToTraceFormat& r) { assign(r); }
WebConvertableToTraceFormat& operator=(const WebConvertableToTraceFormat& r)
{
assign(r);
return *this;
}
private:
WebPrivatePtr<TraceEvent::ConvertableToTraceFormat> m_private;
};
} // namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBCONVERTABLETOTRACEFORMAT_H_
......@@ -82,10 +82,4 @@ blink::WebUnitTestSupport* PlatformImpl::unitTestSupport() {
return &unit_test_support_;
}
const unsigned char* PlatformImpl::getTraceCategoryEnabledFlag(
const char* category_name) {
static const unsigned char buf[] = "*";
return buf;
}
} // namespace sky
......@@ -27,8 +27,6 @@ class PlatformImpl : public blink::Platform {
virtual void setSharedTimerFiredFunction(void (*func)());
virtual void setSharedTimerFireInterval(double interval_seconds);
virtual void stopSharedTimer();
virtual const unsigned char* getTraceCategoryEnabledFlag(
const char* category_name);
private:
void SuspendSharedTimer();
......
......@@ -34,7 +34,6 @@
#include "sky/engine/v8_inspector/InjectedScriptBase.h"
#include "sky/engine/bindings/core/v8/ScriptFunctionCall.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/wtf/text/WTFString.h"
......@@ -113,10 +112,6 @@ const ScriptValue& InjectedScriptBase::injectedScriptObject() const
ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall& function, bool& hadException) const
{
ASSERT(!isEmpty());
ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->executionContext();
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", InspectorFunctionCallEvent::data(executionContext, 0, name(), 1));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
ScriptState* scriptState = m_injectedScriptObject.scriptState();
bool evalIsDisabled = false;
if (scriptState) {
......@@ -131,7 +126,6 @@ ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
if (evalIsDisabled)
scriptState->setEvalEnabled(false);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
return resultValue;
}
......
......@@ -41,7 +41,6 @@
#include "sky/engine/core/dom/ExecutionContext.h"
#include "sky/engine/core/frame/FrameConsole.h"
#include "sky/engine/core/frame/LocalFrame.h"
#include "sky/engine/core/inspector/InspectorTraceEvents.h"
#include "sky/engine/v8_inspector/inspector_host.h"
#include "sky/engine/v8_inspector/ScriptDebugListener.h"
#include "sky/engine/wtf/OwnPtr.h"
......@@ -155,13 +154,9 @@ void PageScriptDebugServer::runScript(ScriptState* scriptState, const String& sc
ExecutionContext* executionContext = scriptState->executionContext();
LocalFrame* frame = executionContext->executingWindow()->frame();
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript", "data", InspectorEvaluateScriptEvent::data(sourceURL, TextPosition::minimumPosition().m_line.oneBasedInt()));
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::currentCallStack());
RefPtr<LocalFrame> protect = frame;
ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, exceptionDetailsText, lineNumber, columnNumber, stackTrace);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data());
}
ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handle<v8::Context> context)
......
......@@ -15,29 +15,9 @@
#include "net/base/data_url.h"
#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
#include "sky/engine/public/platform/WebConvertableToTraceFormat.h"
#include "sky/viewer/platform/weburlloader_impl.h"
namespace sky {
namespace {
class ConvertableToTraceFormatWrapper
: public base::debug::ConvertableToTraceFormat {
public:
explicit ConvertableToTraceFormatWrapper(
const blink::WebConvertableToTraceFormat& convertable)
: convertable_(convertable) {}
virtual void AppendAsTraceFormat(std::string* out) const override {
*out += convertable_.asTraceFormat().utf8();
}
private:
virtual ~ConvertableToTraceFormatWrapper() {}
blink::WebConvertableToTraceFormat convertable_;
};
} // namespace
PlatformImpl::PlatformImpl(mojo::ApplicationImpl* app)
: main_loop_(base::MessageLoop::current()),
......@@ -123,80 +103,4 @@ blink::WebURLError PlatformImpl::cancelledError(const blink::WebURL& url)
return error;
}
const unsigned char* PlatformImpl::getTraceCategoryEnabledFlag(
const char* category_group) {
return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
}
COMPILE_ASSERT(
sizeof(blink::Platform::TraceEventHandle) ==
sizeof(base::debug::TraceEventHandle),
TraceEventHandle_types_must_be_same_size);
blink::Platform::TraceEventHandle PlatformImpl::addTraceEvent(
char phase,
const unsigned char* category_group_enabled,
const char* name,
unsigned long long id,
int num_args,
const char** arg_names,
const unsigned char* arg_types,
const unsigned long long* arg_values,
unsigned char flags) {
base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT(
phase, category_group_enabled, name, id,
num_args, arg_names, arg_types, arg_values, NULL, flags);
blink::Platform::TraceEventHandle result;
memcpy(&result, &handle, sizeof(result));
return result;
}
blink::Platform::TraceEventHandle PlatformImpl::addTraceEvent(
char phase,
const unsigned char* category_group_enabled,
const char* name,
unsigned long long id,
int num_args,
const char** arg_names,
const unsigned char* arg_types,
const unsigned long long* arg_values,
const blink::WebConvertableToTraceFormat* convertable_values,
unsigned char flags) {
scoped_refptr<base::debug::ConvertableToTraceFormat> convertable_wrappers[2];
if (convertable_values) {
size_t size = std::min(static_cast<size_t>(num_args),
arraysize(convertable_wrappers));
for (size_t i = 0; i < size; ++i) {
if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) {
convertable_wrappers[i] =
new ConvertableToTraceFormatWrapper(convertable_values[i]);
}
}
}
base::debug::TraceEventHandle handle =
TRACE_EVENT_API_ADD_TRACE_EVENT(phase,
category_group_enabled,
name,
id,
num_args,
arg_names,
arg_types,
arg_values,
convertable_wrappers,
flags);
blink::Platform::TraceEventHandle result;
memcpy(&result, &handle, sizeof(result));
return result;
}
void PlatformImpl::updateTraceEventDuration(
const unsigned char* category_group_enabled,
const char* name,
TraceEventHandle handle) {
base::debug::TraceEventHandle traceEventHandle;
memcpy(&traceEventHandle, &handle, sizeof(handle));
TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
category_group_enabled, name, traceEventHandle);
}
} // namespace sky
......@@ -32,33 +32,6 @@ class PlatformImpl : public blink::Platform {
virtual mojo::NetworkService* networkService();
virtual blink::WebURLLoader* createURLLoader();
virtual blink::WebURLError cancelledError(const blink::WebURL& url) const;
virtual const unsigned char* getTraceCategoryEnabledFlag(
const char* category_name);
virtual TraceEventHandle addTraceEvent(
char phase,
const unsigned char* category_group_enabled,
const char* name,
unsigned long long id,
int num_args,
const char** arg_names,
const unsigned char* arg_types,
const unsigned long long* arg_values,
unsigned char flags);
virtual TraceEventHandle addTraceEvent(
char phase,
const unsigned char* category_group_enabled,
const char* name,
unsigned long long id,
int num_args,
const char** arg_names,
const unsigned char* arg_types,
const unsigned long long* arg_values,
const blink::WebConvertableToTraceFormat* convertable_values,
unsigned char flags);
virtual void updateTraceEventDuration(
const unsigned char* category_group_enabled,
const char* name,
TraceEventHandle);
private:
void SuspendSharedTimer();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册