Пример #1
0
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();
    }
}
Пример #2
0
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();
}
Пример #3
0
void DOMFileSystemSync::reportError(PassOwnPtr<ErrorCallback> errorCallback, PassRefPtrWillBeRawPtr<FileError> fileError)
{
    errorCallback->handleEvent(fileError.get());
}