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

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

Issue 2836473002: Reland of Messaging: Avoid calling non-thread-safe functions in MessagePort::messageAvailable() (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/MessagePort.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/TaskRunnerHelper.h" 5 #include "core/dom/TaskRunnerHelper.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/workers/WorkerOrWorkletGlobalScope.h" 10 #include "core/workers/WorkerOrWorkletGlobalScope.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, 80 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type,
81 ScriptState* script_state) { 81 ScriptState* script_state) {
82 return Get(type, 82 return Get(type,
83 script_state ? ExecutionContext::From(script_state) : nullptr); 83 script_state ? ExecutionContext::From(script_state) : nullptr);
84 } 84 }
85 85
86 RefPtr<WebTaskRunner> TaskRunnerHelper::Get( 86 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(
87 TaskType type, 87 TaskType type,
88 WorkerOrWorkletGlobalScope* global_scope) { 88 WorkerOrWorkletGlobalScope* global_scope) {
89 DCHECK(global_scope); 89 DCHECK(global_scope);
90 // TODO(nhiroki): Add |DCHECK(global_scope->IsContextThread())| here after 90 DCHECK(global_scope->IsContextThread());
91 // https://crbug.com/694925 is fixed.
92 return Get(type, global_scope->GetThread()); 91 return Get(type, global_scope->GetThread());
93 } 92 }
94 93
95 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, 94 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type,
96 WorkerThread* worker_thread) { 95 WorkerThread* worker_thread) {
97 switch (type) { 96 switch (type) {
98 case TaskType::kDOMManipulation: 97 case TaskType::kDOMManipulation:
99 case TaskType::kUserInteraction: 98 case TaskType::kUserInteraction:
100 case TaskType::kNetworking: 99 case TaskType::kNetworking:
101 case TaskType::kHistoryTraversal: 100 case TaskType::kHistoryTraversal:
(...skipping 20 matching lines...) Expand all
122 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and 121 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and
123 // move them into other task runners. See also comments in 122 // move them into other task runners. See also comments in
124 // Get(LocalFrame). (https://crbug.com/670534) 123 // Get(LocalFrame). (https://crbug.com/670534)
125 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); 124 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner();
126 } 125 }
127 NOTREACHED(); 126 NOTREACHED();
128 return nullptr; 127 return nullptr;
129 } 128 }
130 129
131 } // namespace blink 130 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/MessagePort.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698