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

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

Issue 2534803002: Move InspectorTask handling from MainThreadTaskRunner to Document (Closed)
Patch Set: s/wrapWeakPersistent/wrapCrossThreadWeakPersistent/ Created 4 years 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 5691 matching lines...) Expand 10 before | Expand all | Expand 10 after
5702 // FIXME(crbug.com/305497): This should be removed after 5702 // FIXME(crbug.com/305497): This should be removed after
5703 // ExecutionContext-LocalDOMWindow migration. 5703 // ExecutionContext-LocalDOMWindow migration.
5704 void Document::postTask(const WebTraceLocation& location, 5704 void Document::postTask(const WebTraceLocation& location,
5705 std::unique_ptr<ExecutionContextTask> task, 5705 std::unique_ptr<ExecutionContextTask> task,
5706 const String& taskNameForInstrumentation) { 5706 const String& taskNameForInstrumentation) {
5707 m_taskRunner->postTask(location, std::move(task), taskNameForInstrumentation); 5707 m_taskRunner->postTask(location, std::move(task), taskNameForInstrumentation);
5708 } 5708 }
5709 5709
5710 void Document::postInspectorTask(const WebTraceLocation& location, 5710 void Document::postInspectorTask(const WebTraceLocation& location,
5711 std::unique_ptr<ExecutionContextTask> task) { 5711 std::unique_ptr<ExecutionContextTask> task) {
5712 m_taskRunner->postInspectorTask(location, std::move(task)); 5712 TaskRunnerHelper::get(TaskType::Internal, this)
5713 ->postTask(location, WTF::bind(&Document::performInspectorTask,
5714 wrapCrossThreadWeakPersistent(this),
haraken 2016/11/28 11:00:43 Does this need to be cross-thread? If this really
tzik 2016/11/29 01:52:38 Yes, this needs to be cross-thread. In addition, t
5715 WTF::passed(std::move(task))));
5713 } 5716 }
5714 5717
5715 void Document::tasksWereSuspended() { 5718 void Document::tasksWereSuspended() {
5716 scriptRunner()->suspend(); 5719 scriptRunner()->suspend();
5717 5720
5718 if (m_parser) 5721 if (m_parser)
5719 m_parser->suspendScheduledTasks(); 5722 m_parser->suspendScheduledTasks();
5720 if (m_scriptedAnimationController) 5723 if (m_scriptedAnimationController)
5721 m_scriptedAnimationController->suspend(); 5724 m_scriptedAnimationController->suspend();
5722 } 5725 }
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
6509 void Document::maybeRecordLoadReason(WouldLoadReason reason) { 6512 void Document::maybeRecordLoadReason(WouldLoadReason reason) {
6510 DCHECK(m_wouldLoadReason == Created || reason != Created); 6513 DCHECK(m_wouldLoadReason == Created || reason != Created);
6511 DCHECK(frame()); 6514 DCHECK(frame());
6512 if (m_wouldLoadReason == Created && frame()->isCrossOriginSubframe() && 6515 if (m_wouldLoadReason == Created && frame()->isCrossOriginSubframe() &&
6513 frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) { 6516 frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) {
6514 recordLoadReasonToHistogram(reason); 6517 recordLoadReasonToHistogram(reason);
6515 } 6518 }
6516 m_wouldLoadReason = reason; 6519 m_wouldLoadReason = reason;
6517 } 6520 }
6518 6521
6522 void Document::performInspectorTask(
6523 std::unique_ptr<ExecutionContextTask> task) {
6524 task->performTask(this);
6525 }
6526
6519 DEFINE_TRACE_WRAPPERS(Document) { 6527 DEFINE_TRACE_WRAPPERS(Document) {
6520 visitor->traceWrappers(m_importsController); 6528 visitor->traceWrappers(m_importsController);
6521 visitor->traceWrappers(m_implementation); 6529 visitor->traceWrappers(m_implementation);
6522 visitor->traceWrappers(m_styleSheetList); 6530 visitor->traceWrappers(m_styleSheetList);
6523 visitor->traceWrappers(m_styleEngine); 6531 visitor->traceWrappers(m_styleEngine);
6524 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { 6532 for (int i = 0; i < numNodeListInvalidationTypes; ++i) {
6525 for (auto list : m_nodeLists[i]) { 6533 for (auto list : m_nodeLists[i]) {
6526 visitor->traceWrappersWithManualWriteBarrier(list); 6534 visitor->traceWrappersWithManualWriteBarrier(list);
6527 } 6535 }
6528 } 6536 }
(...skipping 17 matching lines...) Expand all
6546 } 6554 }
6547 6555
6548 void showLiveDocumentInstances() { 6556 void showLiveDocumentInstances() {
6549 WeakDocumentSet& set = liveDocumentSet(); 6557 WeakDocumentSet& set = liveDocumentSet();
6550 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6558 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6551 for (Document* document : set) 6559 for (Document* document : set)
6552 fprintf(stderr, "- Document %p URL: %s\n", document, 6560 fprintf(stderr, "- Document %p URL: %s\n", document,
6553 document->url().getString().utf8().data()); 6561 document->url().getString().utf8().data());
6554 } 6562 }
6555 #endif 6563 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698