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;)
static void timerTraceProfilerInMainThread(const char* name, int status) { if (!status) { TRACE_EVENT_BEGIN0("v8", name); } else { TRACE_EVENT_END0("v8", name); } }
void V8GCController::minorGCEpilogue(v8::Isolate* isolate) { TRACE_EVENT_END0("v8", "minorGC"); if (isMainThread()) { TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isolate)->previousSamplingState()); ScriptForbiddenScope::exit(); } }
void WebDevToolsAgentImpl::didProcessTask() { if (!m_attached) return; if (InspectorController* ic = inspectorController()) ic->didProcessTask(); TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Program"); flushPendingFrontendMessages(); }
void WebDevToolsAgentImpl::didProcessTask() { if (!m_attached) return; if (InspectorProfilerAgent* profilerAgent = m_instrumentingAgents->inspectorProfilerAgent()) profilerAgent->didProcessTask(); TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Program"); flushPendingProtocolNotifications(); }
void V8GCController::majorGCEpilogue() { v8::HandleScope scope; // The GC can happen on multiple threads in case of dedicated workers which run in-process. { MutexLocker locker(workingSetEstimateMBMutex()); workingSetEstimateMB = MemoryUsageSupport::actualMemoryUsageMB(); } TRACE_EVENT_END0("v8", "GC"); }
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; }
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; }
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 V8GCController::majorGCEpilogue(v8::Isolate* isolate) { TRACE_EVENT_END0("v8", "majorGC"); if (isMainThread()) { TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isolate)->previousSamplingState()); ScriptForbiddenScope::exit(); // Schedule a precise GC to avoid the following scenario: // (1) A DOM object X holds a v8::Persistent to a V8 object. // Assume that X is small but the V8 object is huge. // The v8::Persistent is released when X is destructed. // (2) X's DOM wrapper is created. // (3) The DOM wrapper becomes unreachable. // (4) V8 triggers a GC. The V8's GC collects the DOM wrapper. // However, X is not collected until a next Oilpan's GC is // triggered. // (5) If a lot of such DOM objects are created, we end up with // a situation where V8's GC collects the DOM wrappers but // the DOM objects are not collected forever. (Note that // Oilpan's GC is not triggered unless Oilpan's heap gets full.) // (6) V8 hits OOM. ThreadState::current()->setGCRequested(); } }
void WebDevToolsAgentImpl::didComposite() { TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "CompositeLayers"); if (InspectorController* ic = inspectorController()) ic->didComposite(); }
void LoggingAnnotator::endEvent(const char *eventName) { TRACE_EVENT_END0("gpu.angle", eventName); }