Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2727633006: DevTools: Rename InspectorInstrumentation:: namespace into probe:: (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 TaskRunnerHelper::get(TaskType::Networking, getExecutionContext())); 419 TaskRunnerHelper::get(TaskType::Networking, getExecutionContext()));
420 } 420 }
421 421
422 void onLineStateChange(bool onLine) override { 422 void onLineStateChange(bool onLine) override {
423 AtomicString eventName = 423 AtomicString eventName =
424 onLine ? EventTypeNames::online : EventTypeNames::offline; 424 onLine ? EventTypeNames::online : EventTypeNames::offline;
425 Document* document = toDocument(getExecutionContext()); 425 Document* document = toDocument(getExecutionContext());
426 if (!document->domWindow()) 426 if (!document->domWindow())
427 return; 427 return;
428 document->domWindow()->dispatchEvent(Event::create(eventName)); 428 document->domWindow()->dispatchEvent(Event::create(eventName));
429 InspectorInstrumentation::networkStateChanged(document->frame(), onLine); 429 probe::networkStateChanged(document->frame(), onLine);
430 } 430 }
431 431
432 void contextDestroyed(ExecutionContext* context) override { 432 void contextDestroyed(ExecutionContext* context) override {
433 unregisterAsObserver(context); 433 unregisterAsObserver(context);
434 } 434 }
435 435
436 void unregisterAsObserver(ExecutionContext* context) { 436 void unregisterAsObserver(ExecutionContext* context) {
437 DCHECK(context); 437 DCHECK(context);
438 networkStateNotifier().removeOnLineObserver( 438 networkStateNotifier().removeOnLineObserver(
439 this, TaskRunnerHelper::get(TaskType::Networking, context)); 439 this, TaskRunnerHelper::get(TaskType::Networking, context));
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 m_mediaQueryMatcher = MediaQueryMatcher::create(*this); 609 m_mediaQueryMatcher = MediaQueryMatcher::create(*this);
610 return *m_mediaQueryMatcher; 610 return *m_mediaQueryMatcher;
611 } 611 }
612 612
613 void Document::mediaQueryAffectingValueChanged() { 613 void Document::mediaQueryAffectingValueChanged() {
614 styleEngine().mediaQueryAffectingValueChanged(); 614 styleEngine().mediaQueryAffectingValueChanged();
615 if (needsLayoutTreeUpdate()) 615 if (needsLayoutTreeUpdate())
616 m_evaluateMediaQueriesOnStyleRecalc = true; 616 m_evaluateMediaQueriesOnStyleRecalc = true;
617 else 617 else
618 evaluateMediaQueryList(); 618 evaluateMediaQueryList();
619 InspectorInstrumentation::mediaQueryResultChanged(this); 619 probe::mediaQueryResultChanged(this);
620 } 620 }
621 621
622 void Document::setCompatibilityMode(CompatibilityMode mode) { 622 void Document::setCompatibilityMode(CompatibilityMode mode) {
623 if (m_compatibilityModeLocked || mode == m_compatibilityMode) 623 if (m_compatibilityModeLocked || mode == m_compatibilityMode)
624 return; 624 return;
625 m_compatibilityMode = mode; 625 m_compatibilityMode = mode;
626 selectorQueryCache().invalidate(); 626 selectorQueryCache().invalidate();
627 } 627 }
628 628
629 String Document::compatMode() const { 629 String Document::compatMode() const {
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 // recalcStyle can tear down the layout tree or (unfortunately) run 1991 // recalcStyle can tear down the layout tree or (unfortunately) run
1992 // script. Kill the whole layoutObject if someone managed to get into here in 1992 // script. Kill the whole layoutObject if someone managed to get into here in
1993 // states not allowing tree mutations. 1993 // states not allowing tree mutations.
1994 CHECK(lifecycle().stateAllowsTreeMutations()); 1994 CHECK(lifecycle().stateAllowsTreeMutations());
1995 1995
1996 TRACE_EVENT_BEGIN1("blink,devtools.timeline", "UpdateLayoutTree", "beginData", 1996 TRACE_EVENT_BEGIN1("blink,devtools.timeline", "UpdateLayoutTree", "beginData",
1997 InspectorRecalculateStylesEvent::data(frame())); 1997 InspectorRecalculateStylesEvent::data(frame()));
1998 1998
1999 unsigned startElementCount = styleEngine().styleForElementCount(); 1999 unsigned startElementCount = styleEngine().styleForElementCount();
2000 2000
2001 InspectorInstrumentation::RecalculateStyle recalculateStyleScope(this); 2001 probe::RecalculateStyle recalculateStyleScope(this);
2002 2002
2003 DocumentAnimations::updateAnimationTimingIfNeeded(*this); 2003 DocumentAnimations::updateAnimationTimingIfNeeded(*this);
2004 evaluateMediaQueryListIfNeeded(); 2004 evaluateMediaQueryListIfNeeded();
2005 updateUseShadowTreesIfNeeded(); 2005 updateUseShadowTreesIfNeeded();
2006 updateDistribution(); 2006 updateDistribution();
2007 updateActiveStyle(); 2007 updateActiveStyle();
2008 updateStyleInvalidationIfNeeded(); 2008 updateStyleInvalidationIfNeeded();
2009 2009
2010 // FIXME: We should update style on our ancestor chain before proceeding 2010 // FIXME: We should update style on our ancestor chain before proceeding
2011 // however doing so currently causes several tests to crash, as 2011 // however doing so currently causes several tests to crash, as
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 2474 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
2475 if (ownerElement) 2475 if (ownerElement)
2476 ownerElement->setWidget(nullptr); 2476 ownerElement->setWidget(nullptr);
2477 2477
2478 m_markers->prepareForDestruction(); 2478 m_markers->prepareForDestruction();
2479 2479
2480 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); 2480 m_lifecycle.advanceTo(DocumentLifecycle::Stopping);
2481 2481
2482 if (page()) 2482 if (page())
2483 page()->documentDetached(this); 2483 page()->documentDetached(this);
2484 InspectorInstrumentation::documentDetached(this); 2484 probe::documentDetached(this);
2485 2485
2486 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) 2486 if (m_frame->loader().client()->sharedWorkerRepositoryClient())
2487 m_frame->loader() 2487 m_frame->loader()
2488 .client() 2488 .client()
2489 ->sharedWorkerRepositoryClient() 2489 ->sharedWorkerRepositoryClient()
2490 ->documentDetached(this); 2490 ->documentDetached(this);
2491 2491
2492 // FIXME: consider using SuspendableObject. 2492 // FIXME: consider using SuspendableObject.
2493 if (m_scriptedAnimationController) 2493 if (m_scriptedAnimationController)
2494 m_scriptedAnimationController->clearDocumentPointer(); 2494 m_scriptedAnimationController->clearDocumentPointer();
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 return; 3229 return;
3230 } 3230 }
3231 3231
3232 if (!hasInsertionPoint) 3232 if (!hasInsertionPoint)
3233 open(enteredDocument, ASSERT_NO_EXCEPTION); 3233 open(enteredDocument, ASSERT_NO_EXCEPTION);
3234 3234
3235 DCHECK(m_parser); 3235 DCHECK(m_parser);
3236 PerformanceMonitor::reportGenericViolation( 3236 PerformanceMonitor::reportGenericViolation(
3237 this, PerformanceMonitor::kDiscouragedAPIUse, 3237 this, PerformanceMonitor::kDiscouragedAPIUse,
3238 "Avoid using document.write().", 0, nullptr); 3238 "Avoid using document.write().", 0, nullptr);
3239 InspectorInstrumentation::breakIfNeeded(this, "Document.write"); 3239 probe::breakIfNeeded(this, "Document.write");
3240 m_parser->insert(text); 3240 m_parser->insert(text);
3241 } 3241 }
3242 3242
3243 void Document::write(const String& text, 3243 void Document::write(const String& text,
3244 Document* enteredDocument, 3244 Document* enteredDocument,
3245 ExceptionState& exceptionState) { 3245 ExceptionState& exceptionState) {
3246 write(SegmentedString(text), enteredDocument, exceptionState); 3246 write(SegmentedString(text), enteredDocument, exceptionState);
3247 } 3247 }
3248 3248
3249 void Document::writeln(const String& text, 3249 void Document::writeln(const String& text,
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 if (m_passwordCount > 0) { 4466 if (m_passwordCount > 0) {
4467 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); 4467 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext();
4468 return; 4468 return;
4469 } 4469 }
4470 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible(); 4470 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible();
4471 } 4471 }
4472 4472
4473 void Document::runExecutionContextTask( 4473 void Document::runExecutionContextTask(
4474 std::unique_ptr<ExecutionContextTask> task, 4474 std::unique_ptr<ExecutionContextTask> task,
4475 bool isInstrumented) { 4475 bool isInstrumented) {
4476 InspectorInstrumentation::AsyncTask asyncTask(this, task.get(), 4476 probe::AsyncTask asyncTask(this, task.get(), isInstrumented);
4477 isInstrumented);
4478 task->performTask(this); 4477 task->performTask(this);
4479 } 4478 }
4480 4479
4481 void Document::registerEventFactory( 4480 void Document::registerEventFactory(
4482 std::unique_ptr<EventFactoryBase> eventFactory) { 4481 std::unique_ptr<EventFactoryBase> eventFactory) {
4483 DCHECK(!eventFactories().contains(eventFactory.get())); 4482 DCHECK(!eventFactories().contains(eventFactory.get()));
4484 eventFactories().insert(std::move(eventFactory)); 4483 eventFactories().insert(std::move(eventFactory));
4485 } 4484 }
4486 4485
4487 Event* Document::createEvent(ScriptState* scriptState, 4486 Event* Document::createEvent(ScriptState* scriptState,
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
5324 if (mainResourceWasAlreadyRequested) 5323 if (mainResourceWasAlreadyRequested)
5325 updateStyleAndLayoutTree(); 5324 updateStyleAndLayoutTree();
5326 5325
5327 beginLifecycleUpdatesIfRenderingReady(); 5326 beginLifecycleUpdatesIfRenderingReady();
5328 5327
5329 frame->loader().finishedParsing(); 5328 frame->loader().finishedParsing();
5330 5329
5331 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkDOMContent", 5330 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkDOMContent",
5332 TRACE_EVENT_SCOPE_THREAD, "data", 5331 TRACE_EVENT_SCOPE_THREAD, "data",
5333 InspectorMarkLoadEvent::data(frame)); 5332 InspectorMarkLoadEvent::data(frame));
5334 InspectorInstrumentation::domContentLoadedEventFired(frame); 5333 probe::domContentLoadedEventFired(frame);
5335 } 5334 }
5336 5335
5337 // Schedule dropping of the ElementDataCache. We keep it alive for a while 5336 // Schedule dropping of the ElementDataCache. We keep it alive for a while
5338 // after parsing finishes so that dynamically inserted content can also 5337 // after parsing finishes so that dynamically inserted content can also
5339 // benefit from sharing optimizations. Note that we don't refresh the timer 5338 // benefit from sharing optimizations. Note that we don't refresh the timer
5340 // on cache access since that could lead to huge caches being kept alive 5339 // on cache access since that could lead to huge caches being kept alive
5341 // indefinitely by something innocuous like JS setting .innerHTML repeatedly 5340 // indefinitely by something innocuous like JS setting .innerHTML repeatedly
5342 // on a timer. 5341 // on a timer.
5343 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE); 5342 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE);
5344 5343
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
5821 SourceLocation::create(url().getString(), lineNumber, 0, nullptr)); 5820 SourceLocation::create(url().getString(), lineNumber, 0, nullptr));
5822 } 5821 }
5823 m_frame->console().addMessage(consoleMessage); 5822 m_frame->console().addMessage(consoleMessage);
5824 } 5823 }
5825 5824
5826 void Document::postTask(TaskType taskType, 5825 void Document::postTask(TaskType taskType,
5827 const WebTraceLocation& location, 5826 const WebTraceLocation& location,
5828 std::unique_ptr<ExecutionContextTask> task, 5827 std::unique_ptr<ExecutionContextTask> task,
5829 const String& taskNameForInstrumentation) { 5828 const String& taskNameForInstrumentation) {
5830 if (!taskNameForInstrumentation.isEmpty()) { 5829 if (!taskNameForInstrumentation.isEmpty()) {
5831 InspectorInstrumentation::asyncTaskScheduled( 5830 probe::asyncTaskScheduled(this, taskNameForInstrumentation, task.get());
5832 this, taskNameForInstrumentation, task.get());
5833 } 5831 }
5834 5832
5835 TaskRunnerHelper::get(taskType, this) 5833 TaskRunnerHelper::get(taskType, this)
5836 ->postTask(location, 5834 ->postTask(location,
5837 crossThreadBind(&Document::runExecutionContextTask, 5835 crossThreadBind(&Document::runExecutionContextTask,
5838 wrapCrossThreadWeakPersistent(this), 5836 wrapCrossThreadWeakPersistent(this),
5839 WTF::passed(std::move(task)), 5837 WTF::passed(std::move(task)),
5840 !taskNameForInstrumentation.isEmpty())); 5838 !taskNameForInstrumentation.isEmpty()));
5841 } 5839 }
5842 5840
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
6660 } 6658 }
6661 6659
6662 void showLiveDocumentInstances() { 6660 void showLiveDocumentInstances() {
6663 WeakDocumentSet& set = liveDocumentSet(); 6661 WeakDocumentSet& set = liveDocumentSet();
6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6662 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6665 for (blink::Document* document : set) 6663 for (blink::Document* document : set)
6666 fprintf(stderr, "- Document %p URL: %s\n", document, 6664 fprintf(stderr, "- Document %p URL: %s\n", document,
6667 document->url().getString().utf8().data()); 6665 document->url().getString().utf8().data());
6668 } 6666 }
6669 #endif 6667 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698