| Index: third_party/WebKit/Source/core/dom/MessagePort.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/MessagePort.cpp b/third_party/WebKit/Source/core/dom/MessagePort.cpp
|
| index 74e1986e847d9991bacf4b93bade62df4f1d39ce..e4c0a2f3268134928213bbcd7c302421cd8832a8 100644
|
| --- a/third_party/WebKit/Source/core/dom/MessagePort.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/MessagePort.cpp
|
| @@ -33,11 +33,11 @@
|
| #include "bindings/core/v8/SerializedScriptValueFactory.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/dom/ExecutionContext.h"
|
| -#include "core/dom/ExecutionContextTask.h"
|
| #include "core/dom/TaskRunnerHelper.h"
|
| #include "core/events/MessageEvent.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| #include "core/workers/WorkerGlobalScope.h"
|
| +#include "platform/CrossThreadFunctional.h"
|
| #include "platform/wtf/Atomics.h"
|
| #include "platform/wtf/PtrUtil.h"
|
| #include "platform/wtf/text/AtomicString.h"
|
| @@ -51,9 +51,8 @@
|
|
|
| MessagePort::MessagePort(ExecutionContext& execution_context)
|
| : ContextLifecycleObserver(&execution_context),
|
| - pending_dispatch_task_(0),
|
| - started_(false),
|
| - closed_(false) {}
|
| + task_runner_(TaskRunnerHelper::Get(TaskType::kPostedMessage,
|
| + &execution_context)) {}
|
|
|
| MessagePort::~MessagePort() {
|
| DCHECK(!started_ || !IsEntangled());
|
| @@ -122,13 +121,9 @@
|
| if (AtomicTestAndSetToOne(&pending_dispatch_task_))
|
| return;
|
|
|
| - DCHECK(GetExecutionContext());
|
| - // TODO(tzik): Use ParentThreadTaskRunners instead of ExecutionContext here to
|
| - // avoid touching foreign thread GCed object.
|
| - GetExecutionContext()->PostTask(
|
| - TaskType::kPostedMessage, BLINK_FROM_HERE,
|
| - CreateCrossThreadTask(&MessagePort::DispatchMessages,
|
| - WrapCrossThreadWeakPersistent(this)));
|
| + task_runner_->PostTask(BLINK_FROM_HERE,
|
| + CrossThreadBind(&MessagePort::DispatchMessages,
|
| + WrapCrossThreadWeakPersistent(this)));
|
| }
|
|
|
| void MessagePort::start() {
|
|
|