void MIDIAccessPromise::then(PassOwnPtr<MIDISuccessCallback> successCallback, PassOwnPtr<MIDIErrorCallback> errorCallback) { // Lazily request access. if (!m_access) m_access = MIDIAccess::create(executionContext(), this); switch (m_state) { case Accepted: m_state = Invoked; successCallback->handleEvent(m_access.get(), m_options->sysex); clear(); break; case Rejected: m_state = Invoked; errorCallback->handleEvent(m_error.get()); clear(); break; case Pending: m_successCallback = successCallback; m_errorCallback = errorCallback; break; case Invoked: break; default: ASSERT_NOT_REACHED(); } }
void LayerDrawLooperBuilder::addLayerOnTop( DrawLooperLayerInfo* layer_info, PassOwnPtr<DrawLooperAddLayerCallback> callback) { SkPaint* sk_paint = draw_looper_builder_.addLayerOnTop(layer_info->layer_info()); RefPtr<Paint> paint = Paint::create(); paint->setPaint(*sk_paint); callback->handleEvent(paint.get()); *sk_paint = paint->paint(); }
void DOMFileSystemSync::reportError(PassOwnPtr<ErrorCallback> errorCallback, PassRefPtrWillBeRawPtr<FileError> fileError) { errorCallback->handleEvent(fileError.get()); }