1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73

android_webview / browser / gfx / task_forwarding_sequence.cc [blame]

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "android_webview/browser/gfx/task_forwarding_sequence.h"

#include "android_webview/browser/gfx/task_queue_webview.h"
#include "base/notreached.h"

namespace android_webview {

TaskForwardingSequence::TaskForwardingSequence(TaskQueueWebView* task_queue)
    : task_queue_(task_queue) {
  task_queue_->EnsureSequenceInitialized();
}

TaskForwardingSequence::~TaskForwardingSequence() = default;

gpu::SequenceId TaskForwardingSequence::GetSequenceId() {
  return task_queue_->GetSequenceId();
}

bool TaskForwardingSequence::ShouldYield() {
  return false;
}

void TaskForwardingSequence::ScheduleTask(
    gpu::TaskCallback task,
    std::vector<gpu::SyncToken> sync_token_fences,
    const gpu::SyncToken& release,
    gpu::ReportingCallback report_callback) {
  task_queue_->ScheduleTask(std::move(task), std::move(sync_token_fences),
                            release, std::move(report_callback));
}

void TaskForwardingSequence::ScheduleTask(
    base::OnceClosure task,
    std::vector<gpu::SyncToken> sync_token_fences,
    const gpu::SyncToken& release,
    gpu::ReportingCallback report_callback) {
  task_queue_->ScheduleTask(std::move(task), std::move(sync_token_fences),
                            release, std::move(report_callback));
}

void TaskForwardingSequence::ScheduleOrRetainTask(
    base::OnceClosure task,
    std::vector<gpu::SyncToken> sync_token_fences,
    const gpu::SyncToken& release,
    gpu::ReportingCallback report_callback) {
  task_queue_->ScheduleOrRetainTask(std::move(task),
                                    std::move(sync_token_fences), release,
                                    std::move(report_callback));
}

// Should not be called because tasks aren't reposted to wait for sync tokens,
// or for yielding execution since ShouldYield() returns false.
void TaskForwardingSequence::ContinueTask(gpu::TaskCallback task) {
  NOTREACHED();
}

void TaskForwardingSequence::ContinueTask(base::OnceClosure task) {
  NOTREACHED();
}

gpu::ScopedSyncPointClientState
TaskForwardingSequence::CreateSyncPointClientState(
    gpu::CommandBufferNamespace namespace_id,
    gpu::CommandBufferId command_buffer_id) {
  return task_queue_->CreateSyncPointClientState(namespace_id,
                                                 command_buffer_id);
}

}  // namespace android_webview