chromium/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc

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

#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"

#include "base/synchronization/waitable_event.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/ipc/client/client_shared_image_interface.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_graphics_context_3d_provider.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/renderer/platform/graphics/gpu/webgraphics_shared_image_interface_provider_impl.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"

namespace blink {

SharedGpuContext* SharedGpuContext::GetInstanceForCurrentThread() {}

SharedGpuContext::SharedGpuContext() = default;

// static
bool SharedGpuContext::IsGpuCompositingEnabled() {}

base::WeakPtr<WebGraphicsContext3DProviderWrapper>
SharedGpuContext::ContextProviderWrapper() {}

// static
WebGraphicsSharedImageInterfaceProvider*
SharedGpuContext::SharedImageInterfaceProvider() {}

gpu::GpuMemoryBufferManager* SharedGpuContext::GetGpuMemoryBufferManager() {}

void SharedGpuContext::SetGpuMemoryBufferManagerForTesting(
    gpu::GpuMemoryBufferManager* mgr) {}

static void CreateContextProviderOnMainThread(
    bool only_if_gpu_compositing,
    bool* gpu_compositing_disabled,
    std::unique_ptr<WebGraphicsContext3DProviderWrapper>* wrapper,
    gpu::GpuMemoryBufferManager** gpu_memory_buffer_manager,
    base::WaitableEvent* waitable_event) {}

void SharedGpuContext::CreateContextProviderIfNeeded(
    bool only_if_gpu_compositing) {}

static void CreateGpuChannelOnMainThread(
    scoped_refptr<gpu::GpuChannelHost>* gpu_channel,
    base::WaitableEvent* waitable_event) {}

void SharedGpuContext::CreateSharedImageInterfaceProviderIfNeeded() {}

// static
void SharedGpuContext::SetContextProviderFactoryForTesting(
    ContextProviderFactory factory) {}

// static
void SharedGpuContext::Reset() {}

bool SharedGpuContext::IsValidWithoutRestoring() {}

bool SharedGpuContext::AllowSoftwareToAcceleratedCanvasUpgrade() {}

#if BUILDFLAG(IS_ANDROID)
bool SharedGpuContext::MaySupportImageChromium() {
  SharedGpuContext* this_ptr = GetInstanceForCurrentThread();
  this_ptr->CreateContextProviderIfNeeded(/*only_if_gpu_compositing=*/true);
  if (!this_ptr->context_provider_wrapper_) {
    return false;
  }
  const gpu::GpuFeatureInfo& gpu_feature_info =
      this_ptr->context_provider_wrapper_->ContextProvider()
          ->GetGpuFeatureInfo();
  return gpu_feature_info
             .status_values[gpu::GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL] ==
         gpu::kGpuFeatureStatusEnabled;
}
#endif  // BUILDFLAG(IS_ANDROID)

}  // blink