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

Side by Side Diff: third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp

Issue 2463453002: "Fix" remaining connection error handlers in Blink (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | third_party/WebKit/Source/modules/nfc/NFC.cpp » ('j') | 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 "modules/imagecapture/ImageCapture.h" 5 #include "modules/imagecapture/ImageCapture.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // TODO(mcasas): Should be using a mojo::StructTraits. 364 // TODO(mcasas): Should be using a mojo::StructTraits.
365 if (blob->data.isEmpty()) 365 if (blob->data.isEmpty())
366 resolver->reject(DOMException::create(UnknownError, "platform error")); 366 resolver->reject(DOMException::create(UnknownError, "platform error"));
367 else 367 else
368 resolver->resolve( 368 resolver->resolve(
369 Blob::create(blob->data.data(), blob->data.size(), blob->mime_type)); 369 Blob::create(blob->data.data(), blob->data.size(), blob->mime_type));
370 m_serviceRequests.remove(resolver); 370 m_serviceRequests.remove(resolver);
371 } 371 }
372 372
373 void ImageCapture::onServiceConnectionError() { 373 void ImageCapture::onServiceConnectionError() {
374 if (!Platform::current()) {
375 // TODO(rockot): Clean this up once renderer shutdown sequence is fixed.
376 return;
377 }
374 m_service.reset(); 378 m_service.reset();
375 for (ScriptPromiseResolver* resolver : m_serviceRequests) 379 for (ScriptPromiseResolver* resolver : m_serviceRequests)
376 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 380 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
377 m_serviceRequests.clear(); 381 m_serviceRequests.clear();
378 } 382 }
379 383
380 DEFINE_TRACE(ImageCapture) { 384 DEFINE_TRACE(ImageCapture) {
381 visitor->trace(m_streamTrack); 385 visitor->trace(m_streamTrack);
382 visitor->trace(m_serviceRequests); 386 visitor->trace(m_serviceRequests);
383 EventTargetWithInlineData::trace(visitor); 387 EventTargetWithInlineData::trace(visitor);
384 ContextLifecycleObserver::trace(visitor); 388 ContextLifecycleObserver::trace(visitor);
385 } 389 }
386 390
387 } // namespace blink 391 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/nfc/NFC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698