void CSSParserImpl::parseStyleSheet(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet) { TRACE_EVENT_BEGIN2( "blink,blink_style", "CSSParserImpl::parseStyleSheet", "baseUrl", context.baseURL().string().utf8(), "mode", context.mode()); TRACE_EVENT_BEGIN0("blink,blink_style", "CSSParserImpl::parseStyleSheet.tokenize"); CSSTokenizer::Scope scope(string); TRACE_EVENT_END0("blink,blink_style", "CSSParserImpl::parseStyleSheet.tokenize"); TRACE_EVENT_BEGIN0("blink,blink_style", "CSSParserImpl::parseStyleSheet.parse"); CSSParserImpl parser(context, styleSheet); bool firstRuleValid = parser.consumeRuleList(scope.tokenRange(), TopLevelRuleList, [&styleSheet](PassRefPtrWillBeRawPtr<StyleRuleBase> rule) { if (rule->isCharsetRule()) return; styleSheet->parserAppendRule(rule); }); styleSheet->setHasSyntacticallyValidCSSHeader(firstRuleValid); TRACE_EVENT_END0("blink,blink_style", "CSSParserImpl::parseStyleSheet.parse"); TRACE_EVENT_END2( "blink,blink_style", "CSSParserImpl::parseStyleSheet", "tokenCount", scope.tokenCount(), "length", string.length()); }
// For historical reasons, we always inc fLockCount, even if we return false. // It would be nice to change this (it seems), and only inc if we actually succeed... bool SkPixelRef::lockPixels() { SkASSERT(!fPreLocked || SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount); if (!fPreLocked) { TRACE_EVENT_BEGIN0("skia", "SkPixelRef::lockPixelsMutex"); SkAutoMutexAcquire ac(*fMutex); TRACE_EVENT_END0("skia", "SkPixelRef::lockPixelsMutex"); SkDEBUGCODE(int oldCount = fLockCount;)
void WebDevToolsAgentImpl::willProcessTask() { if (!m_attached) return; if (InspectorController* ic = inspectorController()) ic->willProcessTask(); TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Program"); }
static void timerTraceProfilerInMainThread(const char* name, int status) { if (!status) { TRACE_EVENT_BEGIN0("v8", name); } else { TRACE_EVENT_END0("v8", name); } }
void WebDevToolsAgentImpl::willProcessTask() { if (!m_attached) return; if (InspectorProfilerAgent* profilerAgent = m_instrumentingAgents->inspectorProfilerAgent()) profilerAgent->willProcessTask(); TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Program"); }
void V8GCController::majorGCPrologue() { TRACE_EVENT_BEGIN0("v8", "GC"); v8::HandleScope scope; WrapperVisitor visitor; v8::V8::VisitHandlesWithClassIds(&visitor); visitor.notifyFinished(); V8PerIsolateData* data = V8PerIsolateData::current(); data->stringCache()->clearOnGC(); }
sk_sp<SkTypeface> WebFontDecoder::decode(SharedBuffer* buffer) { if (!buffer) { setErrorString("Empty Buffer"); return nullptr; } // This is the largest web font size which we'll try to transcode. // TODO(bashi): 30MB seems low. Update the limit if necessary. static const size_t maxWebFontSize = 30 * 1024 * 1024; // 30 MB if (buffer->size() > maxWebFontSize) { setErrorString("Web font size more than 30MB"); return nullptr; } // Most web fonts are compressed, so the result can be much larger than // the original. ots::ExpandingMemoryStream output(buffer->size(), maxWebFontSize); double start = currentTime(); BlinkOTSContext otsContext; const char* data = buffer->data(); TRACE_EVENT_BEGIN0("blink", "DecodeFont"); bool ok = otsContext.Process(&output, reinterpret_cast<const uint8_t*>(data), buffer->size()); TRACE_EVENT_END0("blink", "DecodeFont"); if (!ok) { setErrorString(otsContext.getErrorString()); return nullptr; } const size_t decodedLength = output.Tell(); recordDecodeSpeedHistogram(data, buffer->size(), currentTime() - start, decodedLength); sk_sp<SkData> skData = SkData::MakeWithCopy(output.get(), decodedLength); SkMemoryStream* stream = new SkMemoryStream(skData); #if OS(WIN) sk_sp<SkTypeface> typeface( FontCache::fontCache()->fontManager()->createFromStream(stream)); #else sk_sp<SkTypeface> typeface = SkTypeface::MakeFromStream(stream); #endif if (!typeface) { setErrorString("Not a valid font data"); return nullptr; } m_decodedSize = decodedLength; return typeface; }
void V8GCController::minorGCPrologue(v8::Isolate* isolate) { TRACE_EVENT_BEGIN0("v8", "minorGC"); if (isMainThread()) { ScriptForbiddenScope::enter(); { TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); v8::HandleScope scope(isolate); MinorGCWrapperVisitor visitor(isolate); v8::V8::VisitHandlesForPartialDependence(isolate, &visitor); visitor.notifyFinished(); } V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GET_SAMPLING_STATE()); TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC"); } }
v8::Local<v8::Value> ScriptController::compileAndRunScript(const ScriptSourceCode& source) { ASSERT(v8::Context::InContext()); V8GCController::checkMemoryUsage(); InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine()); v8::Local<v8::Value> result; { // Isolate exceptions that occur when compiling and executing // the code. These exceptions should not interfere with // javascript code we might evaluate from C++ when returning // from here. v8::TryCatch tryCatch; tryCatch.SetVerbose(true); // Compile the script. v8::Local<v8::String> code = v8ExternalString(source.source()); #if PLATFORM(CHROMIUM) TRACE_EVENT_BEGIN0("v8", "v8.compile"); #endif OwnPtr<v8::ScriptData> scriptData = ScriptSourceCode::precompileScript(code, source.cachedScript()); // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at // 1, whereas v8 starts at 0. v8::Handle<v8::Script> script = ScriptSourceCode::compileScript(code, source.url(), source.startPosition(), scriptData.get()); #if PLATFORM(CHROMIUM) TRACE_EVENT_END0("v8", "v8.compile"); TRACE_EVENT0("v8", "v8.run"); #endif // Keep Frame (and therefore ScriptController) alive. RefPtr<Frame> protect(m_frame); result = ScriptRunner::runCompiledScript(script, m_frame->document()); ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); } InspectorInstrumentation::didEvaluateScript(cookie); return result; }
// Create object groups for DOM tree nodes. void V8GCController::majorGCPrologue(v8::Isolate* isolate, bool constructRetainedObjectInfos) { v8::HandleScope scope(isolate); TRACE_EVENT_BEGIN0("v8", "majorGC"); if (isMainThread()) { ScriptForbiddenScope::enter(); { TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMajorGC"); MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); v8::V8::VisitHandlesWithClassIds(isolate, &visitor); visitor.notifyFinished(); } V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GET_SAMPLING_STATE()); TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MajorGC"); } else { MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); v8::V8::VisitHandlesWithClassIds(isolate, &visitor); visitor.notifyFinished(); } }
bool SkPixelRef::lockPixels(LockRec* rec) { SkASSERT(!fPreLocked || SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount); if (!fPreLocked) { TRACE_EVENT_BEGIN0("skia", "SkPixelRef::lockPixelsMutex"); SkAutoMutexAcquire ac(*fMutex); TRACE_EVENT_END0("skia", "SkPixelRef::lockPixelsMutex"); if (1 == ++fLockCount) { SkASSERT(fRec.isZero()); LockRec rec; if (!this->onNewLockPixels(&rec)) { return false; } SkASSERT(!rec.isZero()); // else why did onNewLock return true? fRec = rec; } } *rec = fRec; return true; }
void LoggingAnnotator::beginEvent(const char *eventName, const char *eventMessage) { TRACE_EVENT_BEGIN0("gpu.angle", eventName); }