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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp

Issue 2587723002: Specify TaskType of posted Task explicitly in Presentation API (10) (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/TaskRunnerHelper.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "modules/presentation/PresentationConnection.h" 5 #include "modules/presentation/PresentationConnection.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/DOMArrayBufferView.h" 9 #include "core/dom/DOMArrayBufferView.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/dom/ExecutionContextTask.h" 12 #include "core/dom/ExecutionContextTask.h"
13 #include "core/dom/TaskRunnerHelper.h"
13 #include "core/events/Event.h" 14 #include "core/events/Event.h"
14 #include "core/events/MessageEvent.h" 15 #include "core/events/MessageEvent.h"
15 #include "core/fileapi/FileReaderLoader.h" 16 #include "core/fileapi/FileReaderLoader.h"
16 #include "core/fileapi/FileReaderLoaderClient.h" 17 #include "core/fileapi/FileReaderLoaderClient.h"
17 #include "core/frame/Deprecation.h" 18 #include "core/frame/Deprecation.h"
18 #include "core/frame/LocalFrame.h" 19 #include "core/frame/LocalFrame.h"
19 #include "core/frame/UseCounter.h" 20 #include "core/frame/UseCounter.h"
20 #include "modules/EventTargetModules.h" 21 #include "modules/EventTargetModules.h"
21 #include "modules/presentation/Presentation.h" 22 #include "modules/presentation/Presentation.h"
22 #include "modules/presentation/PresentationConnectionAvailableEvent.h" 23 #include "modules/presentation/PresentationConnectionAvailableEvent.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 ASSERT(request); 191 ASSERT(request);
191 192
192 PresentationConnection* connection = new PresentationConnection( 193 PresentationConnection* connection = new PresentationConnection(
193 controller->frame(), client->getId(), client->getUrl()); 194 controller->frame(), client->getId(), client->getUrl());
194 controller->registerConnection(connection); 195 controller->registerConnection(connection);
195 196
196 // Fire onconnectionavailable event asynchronously. 197 // Fire onconnectionavailable event asynchronously.
197 auto* event = PresentationConnectionAvailableEvent::create( 198 auto* event = PresentationConnectionAvailableEvent::create(
198 EventTypeNames::connectionavailable, connection); 199 EventTypeNames::connectionavailable, connection);
199 request->getExecutionContext()->postTask( 200 request->getExecutionContext()->postTask(
200 BLINK_FROM_HERE, 201 TaskType::Presentation, BLINK_FROM_HERE,
201 createSameThreadTask(&PresentationConnection::dispatchEventAsync, 202 createSameThreadTask(&PresentationConnection::dispatchEventAsync,
202 wrapPersistent(request), wrapPersistent(event))); 203 wrapPersistent(request), wrapPersistent(event)));
203 204
204 return connection; 205 return connection;
205 } 206 }
206 207
207 // static 208 // static
208 PresentationConnection* PresentationConnection::take( 209 PresentationConnection* PresentationConnection::take(
209 PresentationReceiver* receiver, 210 PresentationReceiver* receiver,
210 std::unique_ptr<WebPresentationConnectionClient> client) { 211 std::unique_ptr<WebPresentationConnectionClient> client) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob); 467 ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
467 // FIXME: generate error message? 468 // FIXME: generate error message?
468 // Ignore the current failed blob item and continue with next items. 469 // Ignore the current failed blob item and continue with next items.
469 m_messages.removeFirst(); 470 m_messages.removeFirst();
470 m_blobLoader.clear(); 471 m_blobLoader.clear();
471 handleMessageQueue(); 472 handleMessageQueue();
472 } 473 }
473 474
474 void PresentationConnection::dispatchStateChangeEvent(Event* event) { 475 void PresentationConnection::dispatchStateChangeEvent(Event* event) {
475 getExecutionContext()->postTask( 476 getExecutionContext()->postTask(
476 BLINK_FROM_HERE, 477 TaskType::Presentation, BLINK_FROM_HERE,
477 createSameThreadTask(&PresentationConnection::dispatchEventAsync, 478 createSameThreadTask(&PresentationConnection::dispatchEventAsync,
478 wrapPersistent(this), wrapPersistent(event))); 479 wrapPersistent(this), wrapPersistent(event)));
479 } 480 }
480 481
481 // static 482 // static
482 void PresentationConnection::dispatchEventAsync(EventTarget* target, 483 void PresentationConnection::dispatchEventAsync(EventTarget* target,
483 Event* event) { 484 Event* event) {
484 DCHECK(target); 485 DCHECK(target);
485 DCHECK(event); 486 DCHECK(event);
486 target->dispatchEvent(event); 487 target->dispatchEvent(event);
487 } 488 }
488 489
489 void PresentationConnection::tearDown() { 490 void PresentationConnection::tearDown() {
490 // Cancel current Blob loading if any. 491 // Cancel current Blob loading if any.
491 if (m_blobLoader) { 492 if (m_blobLoader) {
492 m_blobLoader->cancel(); 493 m_blobLoader->cancel();
493 m_blobLoader.clear(); 494 m_blobLoader.clear();
494 } 495 }
495 m_messages.clear(); 496 m_messages.clear();
496 } 497 }
497 498
498 } // namespace blink 499 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698