Commit b45f07cc authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Rename GpuCommandBufferStub to CommandBufferStub

This is part of a larger refactoring. The overall call is to have two Stub
implementations in the GPU process:
- a RasterInterface client will have a RasterCmdBuffStub on the server side and
- a GLES2Interface client will have a GLES2CmdBuffStub on the server side

Rationale for having different stubs are that they are coupled to the decoder,
context, and scheduling. In the future, the RasterInterface backend will diverge
from the GLES2Interface backed in these respects.

Step 1: Create CommandBufferStub class.
Step 2 (separate CL): Have GLES2CmdBuffStub and RasterCmdBuffStub inherit from
CommandBufferStub (see crrev.com/c/796951 for WIP patch).

BUG=789238

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ic15f80bed7fc0e7e4637832378e6502a77568c73
Reviewed-on: https://chromium-review.googlesource.com/806719
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521683}
parent bd7ce60f
......@@ -203,8 +203,8 @@ gpu::gles2::ContextCreationAttribHelper GetCompositorContextAttributes(
} else if (base::SysInfo::AmountOfPhysicalMemoryMB() <= 512) {
// In this case we prefer to use RGB565 format instead of RGBA8888 if
// possible.
// TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in
// order to enable 565, but it should avoid using 565 when -1s are
// TODO(danakj): CommandBufferStub constructor checks for alpha == 0
// in order to enable 565, but it should avoid using 565 when -1s are
// specified
// (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be
// -1.
......
......@@ -76,10 +76,10 @@ IPC_STRUCT_END()
// These are messages from a renderer process to the GPU process.
// Tells the GPU process to create a new command buffer. A corresponding
// GpuCommandBufferStub is created. if |surface_handle| is non-null, |size| is
// ignored, and it will render directly to the native surface (only the browser
// process is allowed to create those). Otherwise it will create an offscreen
// backbuffer of dimensions |size|.
// CommandBufferStub is created. If |surface_handle| is non-null, |size|
// is ignored, and it will render directly to the native surface (only the
// browser process is allowed to create those). Otherwise it will create an
// offscreen backbuffer of dimensions |size|.
IPC_SYNC_MESSAGE_CONTROL3_2(GpuChannelMsg_CreateCommandBuffer,
GPUCreateCommandBufferConfig /* init_params */,
int32_t /* route_id */,
......@@ -87,7 +87,7 @@ IPC_SYNC_MESSAGE_CONTROL3_2(GpuChannelMsg_CreateCommandBuffer,
gpu::ContextResult,
gpu::Capabilities /* capabilities */)
// The CommandBufferProxy sends this to the GpuCommandBufferStub in its
// The CommandBufferProxy sends this to the CommandBufferStub in its
// destructor, so that the stub deletes the actual CommandBufferService
// object that it's hosting.
IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
......
......@@ -28,13 +28,13 @@ if (is_component_build) {
target(link_target_type, "ipc_service_sources") {
visibility = [ "//gpu/*" ]
sources = [
"command_buffer_stub.cc",
"command_buffer_stub.h",
"gpu_channel.cc",
"gpu_channel.h",
"gpu_channel_manager.cc",
"gpu_channel_manager.h",
"gpu_channel_manager_delegate.h",
"gpu_command_buffer_stub.cc",
"gpu_command_buffer_stub.h",
"gpu_config.h",
"gpu_init.cc",
"gpu_init.h",
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
#define GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
#ifndef GPU_IPC_SERVICE_COMMAND_BUFFER_STUB_H_
#define GPU_IPC_SERVICE_COMMAND_BUFFER_STUB_H_
#include <stddef.h>
#include <stdint.h>
......@@ -16,6 +16,7 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "gpu/command_buffer/common/command_buffer_id.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
......@@ -50,13 +51,13 @@ struct WaitForCommandState;
class GpuChannel;
class SyncPointClientState;
class GPU_EXPORT GpuCommandBufferStub
class GPU_EXPORT CommandBufferStub
: public IPC::Listener,
public IPC::Sender,
public CommandBufferServiceClient,
public gles2::GLES2DecoderClient,
public ImageTransportSurfaceDelegate,
public base::SupportsWeakPtr<GpuCommandBufferStub> {
public base::SupportsWeakPtr<CommandBufferStub> {
public:
class DestructionObserver {
public:
......@@ -67,20 +68,20 @@ class GPU_EXPORT GpuCommandBufferStub
virtual ~DestructionObserver() {}
};
GpuCommandBufferStub(GpuChannel* channel,
const GPUCreateCommandBufferConfig& init_params,
CommandBufferId command_buffer_id,
SequenceId sequence_id,
int32_t stream_id,
int32_t route_id);
CommandBufferStub(GpuChannel* channel,
const GPUCreateCommandBufferConfig& init_params,
CommandBufferId command_buffer_id,
SequenceId sequence_id,
int32_t stream_id,
int32_t route_id);
~GpuCommandBufferStub() override;
~CommandBufferStub() override;
// This must leave the GL context associated with the newly-created
// GpuCommandBufferStub current, so the GpuChannel can initialize
// CommandBufferStub current, so the GpuChannel can initialize
// the gpu::Capabilities.
gpu::ContextResult Initialize(
GpuCommandBufferStub* share_group,
CommandBufferStub* share_group,
const GPUCreateCommandBufferConfig& init_params,
std::unique_ptr<base::SharedMemory> shared_state_shm);
......@@ -207,8 +208,8 @@ class GPU_EXPORT GpuCommandBufferStub
const GpuFeatureInfo& gpu_feature_info);
// The lifetime of objects of this class is managed by a GpuChannel. The
// GpuChannels destroy all the GpuCommandBufferStubs that they own when they
// are destroyed. So a raw pointer is safe.
// GpuChannels destroy all the CommandBufferStubs that they own when
// they are destroyed. So a raw pointer is safe.
GpuChannel* const channel_;
// The group of contexts that share namespaces with this context.
......@@ -246,9 +247,9 @@ class GPU_EXPORT GpuCommandBufferStub
std::unique_ptr<WaitForCommandState> wait_for_get_offset_;
uint32_t wait_set_get_buffer_count_;
DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
DISALLOW_COPY_AND_ASSIGN(CommandBufferStub);
};
} // namespace gpu
#endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
#endif // GPU_IPC_SERVICE_COMMAND_BUFFER_STUB_H_
......@@ -421,15 +421,15 @@ bool GpuChannel::Send(IPC::Message* message) {
return channel_->Send(message);
}
void GpuChannel::OnCommandBufferScheduled(GpuCommandBufferStub* stub) {
void GpuChannel::OnCommandBufferScheduled(CommandBufferStub* stub) {
scheduler_->EnableSequence(stub->sequence_id());
}
void GpuChannel::OnCommandBufferDescheduled(GpuCommandBufferStub* stub) {
void GpuChannel::OnCommandBufferDescheduled(CommandBufferStub* stub) {
scheduler_->DisableSequence(stub->sequence_id());
}
GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32_t route_id) {
CommandBufferStub* GpuChannel::LookupCommandBuffer(int32_t route_id) {
auto it = stubs_.find(route_id);
if (it == stubs_.end())
return nullptr;
......@@ -486,7 +486,7 @@ bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
void GpuChannel::HandleMessage(const IPC::Message& msg) {
int32_t routing_id = msg.routing_id();
GpuCommandBufferStub* stub = LookupCommandBuffer(routing_id);
CommandBufferStub* stub = LookupCommandBuffer(routing_id);
DCHECK(!stub || stub->IsScheduled());
......@@ -536,9 +536,9 @@ void GpuChannel::HandleOutOfOrderMessage(const IPC::Message& msg) {
}
#if defined(OS_ANDROID)
const GpuCommandBufferStub* GpuChannel::GetOneStub() const {
const CommandBufferStub* GpuChannel::GetOneStub() const {
for (const auto& kv : stubs_) {
const GpuCommandBufferStub* stub = kv.second.get();
const CommandBufferStub* stub = kv.second.get();
if (stub->decoder() && !stub->decoder()->WasContextLost())
return stub;
}
......@@ -570,7 +570,7 @@ void GpuChannel::OnCreateCommandBuffer(
}
int32_t share_group_id = init_params.share_group_id;
GpuCommandBufferStub* share_group = LookupCommandBuffer(share_group_id);
CommandBufferStub* share_group = LookupCommandBuffer(share_group_id);
if (!share_group && share_group_id != MSG_ROUTING_NONE) {
LOG(ERROR) << "ContextResult::kFatalFailure: invalid share group id";
......@@ -621,13 +621,13 @@ void GpuChannel::OnCreateCommandBuffer(
<< (gpu_channel_manager_->gpu_preferences().enable_raster_decoder &&
init_params.attribs.enable_oop_rasterization);
auto stub = std::make_unique<GpuCommandBufferStub>(
auto stub = std::make_unique<CommandBufferStub>(
this, init_params, command_buffer_id, sequence_id, stream_id, route_id);
auto stub_result =
stub->Initialize(share_group, init_params, std::move(shared_state_shm));
if (stub_result != gpu::ContextResult::kSuccess) {
DLOG(ERROR) << "GpuChannel::CreateCommandBuffer(): failed to initialize "
"GpuCommandBufferStub";
"CommandBufferStub";
*result = stub_result;
return;
}
......@@ -646,7 +646,7 @@ void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) {
TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", "route_id",
route_id);
std::unique_ptr<GpuCommandBufferStub> stub;
std::unique_ptr<CommandBufferStub> stub;
auto it = stubs_.find(route_id);
if (it != stubs_.end()) {
stub = std::move(it->second);
......
......@@ -22,7 +22,7 @@
#include "gpu/command_buffer/common/context_result.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/gpu_export.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "gpu/ipc/service/gpu_memory_manager.h"
#include "ipc/ipc_sender.h"
#include "ipc/ipc_sync_channel.h"
......@@ -134,12 +134,12 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
void AddFilter(IPC::MessageFilter* filter) override;
void RemoveFilter(IPC::MessageFilter* filter) override;
void OnCommandBufferScheduled(GpuCommandBufferStub* stub);
void OnCommandBufferDescheduled(GpuCommandBufferStub* stub);
void OnCommandBufferScheduled(CommandBufferStub* stub);
void OnCommandBufferDescheduled(CommandBufferStub* stub);
gl::GLShareGroup* share_group() const { return share_group_.get(); }
GpuCommandBufferStub* LookupCommandBuffer(int32_t route_id);
CommandBufferStub* LookupCommandBuffer(int32_t route_id);
bool HasActiveWebGLContext() const;
void LoseAllContexts();
......@@ -175,7 +175,7 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
void HandleMessageForTesting(const IPC::Message& msg);
#if defined(OS_ANDROID)
const GpuCommandBufferStub* GetOneStub() const;
const CommandBufferStub* GetOneStub() const;
#endif
private:
......@@ -199,7 +199,7 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
scoped_refptr<GpuChannelMessageFilter> filter_;
// Map of routing id to command buffer stub.
base::flat_map<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_;
base::flat_map<int32_t, std::unique_ptr<CommandBufferStub>> stubs_;
// Map of stream id to scheduler sequence id.
base::flat_map<int32_t, SequenceId> stream_sequences_;
......
......@@ -249,7 +249,7 @@ void GpuChannelManager::ScheduleWakeUpGpu() {
}
void GpuChannelManager::DoWakeUpGpu() {
const GpuCommandBufferStub* stub = nullptr;
const CommandBufferStub* stub = nullptr;
for (const auto& kv : gpu_channels_) {
const GpuChannel* channel = kv.second.get();
stub = channel->GetOneStub();
......
......@@ -45,7 +45,7 @@ class GpuChannelManagerTest : public GpuChannelTestCommon {
&result, &capabilities));
EXPECT_EQ(result, gpu::ContextResult::kSuccess);
GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
CommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
EXPECT_TRUE(stub);
channel_manager()->OnApplicationBackgroundedForTesting();
......
......@@ -42,7 +42,7 @@ TEST_F(GpuChannelTest, CreateViewCommandBufferAllowed) {
&capabilities));
EXPECT_EQ(result, gpu::ContextResult::kSuccess);
GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
CommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
ASSERT_TRUE(stub);
}
......@@ -70,7 +70,7 @@ TEST_F(GpuChannelTest, CreateViewCommandBufferDisallowed) {
&capabilities));
EXPECT_EQ(result, gpu::ContextResult::kFatalFailure);
GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
CommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
EXPECT_FALSE(stub);
}
......@@ -94,7 +94,7 @@ TEST_F(GpuChannelTest, CreateOffscreenCommandBuffer) {
&capabilities));
EXPECT_EQ(result, gpu::ContextResult::kSuccess);
GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
CommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
EXPECT_TRUE(stub);
}
......@@ -120,7 +120,7 @@ TEST_F(GpuChannelTest, IncompatibleStreamIds) {
&capabilities));
EXPECT_EQ(result, gpu::ContextResult::kSuccess);
GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1);
CommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1);
EXPECT_TRUE(stub);
// Create second context in same share group but different stream.
......
......@@ -11,7 +11,7 @@
#import "base/mac/scoped_nsobject.h"
#include "base/timer/timer.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "gpu/ipc/service/image_transport_surface.h"
#include "ui/base/cocoa/remote_layer_api.h"
#include "ui/gl/gl_surface.h"
......
......@@ -26,7 +26,7 @@ using gles2::TextureManager;
using gles2::TextureRef;
// static
bool StreamTexture::Create(GpuCommandBufferStub* owner_stub,
bool StreamTexture::Create(CommandBufferStub* owner_stub,
uint32_t client_texture_id,
int stream_id) {
GLES2Decoder* decoder = owner_stub->decoder();
......@@ -55,7 +55,7 @@ bool StreamTexture::Create(GpuCommandBufferStub* owner_stub,
return false;
}
StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub,
StreamTexture::StreamTexture(CommandBufferStub* owner_stub,
int32_t route_id,
uint32_t texture_id)
: surface_texture_(gl::SurfaceTexture::Create(texture_id)),
......
......@@ -13,7 +13,7 @@
#include "base/memory/weak_ptr.h"
#include "base/unguessable_token.h"
#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "ipc/ipc_listener.h"
#include "ui/gl/android/surface_texture.h"
#include "ui/gl/gl_image.h"
......@@ -30,14 +30,14 @@ namespace gpu {
class StreamTexture : public gpu::gles2::GLStreamTextureImage,
public IPC::Listener,
public GpuCommandBufferStub::DestructionObserver {
public CommandBufferStub::DestructionObserver {
public:
static bool Create(GpuCommandBufferStub* owner_stub,
static bool Create(CommandBufferStub* owner_stub,
uint32_t client_texture_id,
int stream_id);
private:
StreamTexture(GpuCommandBufferStub* owner_stub,
StreamTexture(CommandBufferStub* owner_stub,
int32_t route_id,
uint32_t texture_id);
~StreamTexture() override;
......@@ -70,7 +70,7 @@ class StreamTexture : public gpu::gles2::GLStreamTextureImage,
int display_width,
int display_height) override {}
// GpuCommandBufferStub::DestructionObserver implementation.
// CommandBufferStub::DestructionObserver implementation.
void OnWillDestroyStub() override;
std::unique_ptr<ui::ScopedMakeCurrent> MakeStubCurrent();
......@@ -99,7 +99,7 @@ class StreamTexture : public gpu::gles2::GLStreamTextureImage,
// Whether a new frame is available that we should update to.
bool has_pending_frame_;
GpuCommandBufferStub* owner_stub_;
CommandBufferStub* owner_stub_;
int32_t route_id_;
bool has_listener_;
uint32_t texture_id_;
......
......@@ -15,7 +15,7 @@
#include "ui/gfx/geometry/size.h"
namespace gpu {
class GpuCommandBufferStub;
class CommandBufferStub;
struct SyncToken;
} // namespace gpu
......@@ -30,7 +30,7 @@ class VideoFrame;
// safe. Virtual for testing; see VideoFrameFactoryImpl.
class MEDIA_GPU_EXPORT VideoFrameFactory {
public:
using GetStubCb = base::Callback<gpu::GpuCommandBufferStub*()>;
using GetStubCb = base::Callback<gpu::CommandBufferStub*()>;
using InitCb = base::Callback<void(scoped_refptr<SurfaceTextureGLOwner>)>;
// These mirror types from MojoVideoDecoderService.
......
......@@ -14,8 +14,8 @@
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "gpu/ipc/service/gpu_channel.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/scoped_callback_runner.h"
#include "media/base/video_frame.h"
......@@ -28,7 +28,7 @@
namespace media {
namespace {
bool MakeContextCurrent(gpu::GpuCommandBufferStub* stub) {
bool MakeContextCurrent(gpu::CommandBufferStub* stub) {
return stub && stub->decoder()->MakeCurrent();
}
......
......@@ -8,7 +8,7 @@
#include "base/optional.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "media/base/video_frame.h"
#include "media/gpu/android/codec_image.h"
#include "media/gpu/android/codec_wrapper.h"
......@@ -62,7 +62,7 @@ class MEDIA_GPU_EXPORT VideoFrameFactoryImpl : public VideoFrameFactory {
// GpuVideoFrameFactory is an implementation detail of VideoFrameFactoryImpl. It
// may be created on any thread but only accessed on the gpu thread thereafter.
class GpuVideoFrameFactory
: public gpu::GpuCommandBufferStub::DestructionObserver {
: public gpu::CommandBufferStub::DestructionObserver {
public:
GpuVideoFrameFactory();
~GpuVideoFrameFactory() override;
......@@ -117,7 +117,7 @@ class GpuVideoFrameFactory
// destructed).
std::map<gpu::gles2::TextureRef*, scoped_refptr<gpu::gles2::TextureRef>>
texture_refs_;
gpu::GpuCommandBufferStub* stub_;
gpu::CommandBufferStub* stub_;
// Callback to notify us that an image has been destroyed.
CodecImage::DestructionCb destruction_cb_;
......
......@@ -34,7 +34,7 @@ namespace media {
namespace {
static gl::GLContext* GetGLContext(
const base::WeakPtr<gpu::GpuCommandBufferStub>& stub) {
const base::WeakPtr<gpu::CommandBufferStub>& stub) {
if (!stub) {
DLOG(ERROR) << "Stub is gone; no GLContext.";
return nullptr;
......@@ -44,7 +44,7 @@ static gl::GLContext* GetGLContext(
}
static bool MakeDecoderContextCurrent(
const base::WeakPtr<gpu::GpuCommandBufferStub>& stub) {
const base::WeakPtr<gpu::CommandBufferStub>& stub) {
if (!stub) {
DLOG(ERROR) << "Stub is gone; won't MakeCurrent().";
return false;
......@@ -58,7 +58,7 @@ static bool MakeDecoderContextCurrent(
return true;
}
static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub,
static bool BindImage(const base::WeakPtr<gpu::CommandBufferStub>& stub,
uint32_t client_texture_id,
uint32_t texture_target,
const scoped_refptr<gl::GLImage>& image,
......@@ -75,7 +75,7 @@ static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub,
}
static base::WeakPtr<gpu::gles2::GLES2Decoder> GetGLES2Decoder(
const base::WeakPtr<gpu::GpuCommandBufferStub>& stub) {
const base::WeakPtr<gpu::CommandBufferStub>& stub) {
if (!stub) {
DLOG(ERROR) << "Stub is gone; no GLES2Decoder.";
return base::WeakPtr<gpu::gles2::GLES2Decoder>();
......@@ -145,7 +145,7 @@ class GpuVideoDecodeAccelerator::MessageFilter : public IPC::MessageFilter {
GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
int32_t host_route_id,
gpu::GpuCommandBufferStub* stub,
gpu::CommandBufferStub* stub,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
const AndroidOverlayMojoFactoryCB& overlay_factory_cb)
: host_route_id_(host_route_id),
......
......@@ -18,7 +18,7 @@
#include "base/synchronization/waitable_event.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "media/base/android_overlay_mojo_factory.h"
......@@ -37,14 +37,14 @@ class GpuVideoDecodeAccelerator
: public IPC::Listener,
public IPC::Sender,
public VideoDecodeAccelerator::Client,
public gpu::GpuCommandBufferStub::DestructionObserver {
public gpu::CommandBufferStub::DestructionObserver {
public:
// Each of the arguments to the constructor must outlive this object.
// |stub->decoder()| will be made current around any operation that touches
// the underlying VDA so that it can make GL calls safely.
GpuVideoDecodeAccelerator(
int32_t host_route_id,
gpu::GpuCommandBufferStub* stub,
gpu::CommandBufferStub* stub,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
const AndroidOverlayMojoFactoryCB& factory);
......@@ -72,7 +72,7 @@ class GpuVideoDecodeAccelerator
void NotifyResetDone() override;
void NotifyError(VideoDecodeAccelerator::Error error) override;
// GpuCommandBufferStub::DestructionObserver implementation.
// CommandBufferStub::DestructionObserver implementation.
void OnWillDestroyStub() override;
// Function to delegate sending to actual sender.
......@@ -80,7 +80,7 @@ class GpuVideoDecodeAccelerator
// Initialize VDAs from the set of VDAs supported for current platform until
// one of them succeeds for given |config|. Send the |init_done_msg| when
// done. filter_ is passed to gpu::GpuCommandBufferStub channel only if the
// done. filter_ is passed to gpu::CommandBufferStub channel only if the
// chosen VDA can decode on IO thread.
bool Initialize(const VideoDecodeAccelerator::Config& config);
......@@ -110,10 +110,10 @@ class GpuVideoDecodeAccelerator
// Route ID to communicate with the host.
const int32_t host_route_id_;
// Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is
// Unowned pointer to the underlying gpu::CommandBufferStub. |this| is
// registered as a DestuctionObserver of |stub_| and will self-delete when
// |stub_| is destroyed.
gpu::GpuCommandBufferStub* const stub_;
gpu::CommandBufferStub* const stub_;
// The underlying VideoDecodeAccelerator.
std::unique_ptr<VideoDecodeAccelerator> video_decode_accelerator_;
......
......@@ -91,7 +91,7 @@ class GpuVideoEncodeAccelerator::MessageFilter : public IPC::MessageFilter {
GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(
int32_t host_route_id,
gpu::GpuCommandBufferStub* stub,
gpu::CommandBufferStub* stub,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
: host_route_id_(host_route_id),
stub_(stub),
......
......@@ -16,7 +16,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "ipc/ipc_listener.h"
#include "media/video/video_encode_accelerator.h"
#include "ui/gfx/geometry/size.h"
......@@ -36,11 +36,11 @@ class GpuVideoEncodeAccelerator
: public IPC::Listener,
public IPC::Sender,
public VideoEncodeAccelerator::Client,
public gpu::GpuCommandBufferStub::DestructionObserver {
public gpu::CommandBufferStub::DestructionObserver {
public:
GpuVideoEncodeAccelerator(
int32_t host_route_id,
gpu::GpuCommandBufferStub* stub,
gpu::CommandBufferStub* stub,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
~GpuVideoEncodeAccelerator() override;
......@@ -67,7 +67,7 @@ class GpuVideoEncodeAccelerator
base::TimeDelta timestamp) override;
void NotifyError(VideoEncodeAccelerator::Error error) override;
// gpu::GpuCommandBufferStub::DestructionObserver implementation.
// gpu::CommandBufferStub::DestructionObserver implementation.
void OnWillDestroyStub() override;
// Static query for supported profiles. This query calls the appropriate
......@@ -120,10 +120,10 @@ class GpuVideoEncodeAccelerator
// Route ID to communicate with the host.
const uint32_t host_route_id_;
// Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is
// Unowned pointer to the underlying gpu::CommandBufferStub. |this| is
// registered as a DestuctionObserver of |stub_| and will self-delete when
// |stub_| is destroyed.
gpu::GpuCommandBufferStub* const stub_;
gpu::CommandBufferStub* const stub_;
// Owned pointer to the underlying VideoEncodeAccelerator.
std::unique_ptr<VideoEncodeAccelerator> encoder_;
......
......@@ -115,7 +115,7 @@ void MediaGpuChannel::OnCreateVideoDecoder(
int32_t decoder_route_id,
IPC::Message* reply_message) {
TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoDecoder");
gpu::GpuCommandBufferStub* stub =
gpu::CommandBufferStub* stub =
channel_->LookupCommandBuffer(command_buffer_route_id);
if (!stub) {
reply_message->set_reply_error();
......@@ -139,7 +139,7 @@ void MediaGpuChannel::OnCreateVideoEncoder(
const CreateVideoEncoderParams& params,
IPC::Message* reply_message) {
TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoEncoder");
gpu::GpuCommandBufferStub* stub =
gpu::CommandBufferStub* stub =
channel_->LookupCommandBuffer(command_buffer_route_id);
if (!stub) {
reply_message->set_reply_error();
......
......@@ -46,7 +46,7 @@ namespace media {
D3D11VideoDecoder::D3D11VideoDecoder(
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner,
base::Callback<gpu::GpuCommandBufferStub*()> get_stub_cb,
base::Callback<gpu::CommandBufferStub*()> get_stub_cb,
OutputWithReleaseMailboxCB output_cb)
: impl_task_runner_(std::move(gpu_task_runner)), weak_factory_(this) {
// We create |impl_| on the wrong thread, but we never use it here.
......
......@@ -13,7 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "media/base/video_decoder.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/windows/d3d11_video_decoder_impl.h"
......@@ -30,7 +30,7 @@ namespace media {
class MEDIA_GPU_EXPORT D3D11VideoDecoder : public VideoDecoder {
public:
D3D11VideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner,
base::Callback<gpu::GpuCommandBufferStub*()> get_stub_cb,
base::Callback<gpu::CommandBufferStub*()> get_stub_cb,
OutputWithReleaseMailboxCB output_cb);
~D3D11VideoDecoder() override;
......
......@@ -19,14 +19,14 @@ namespace media {
namespace {
static bool MakeContextCurrent(gpu::GpuCommandBufferStub* stub) {
static bool MakeContextCurrent(gpu::CommandBufferStub* stub) {
return stub && stub->decoder()->MakeCurrent();
}
} // namespace
D3D11VideoDecoderImpl::D3D11VideoDecoderImpl(
base::Callback<gpu::GpuCommandBufferStub*()> get_stub_cb,
base::Callback<gpu::CommandBufferStub*()> get_stub_cb,
OutputWithReleaseMailboxCB output_cb)
: get_stub_cb_(get_stub_cb),
output_cb_(std::move(output_cb)),
......
......@@ -15,7 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "gpu/ipc/service/gpu_command_buffer_stub.h"
#include "gpu/ipc/service/command_buffer_stub.h"
#include "media/base/video_decoder.h"
#include "media/gpu/d3d11_h264_accelerator.h"
#include "media/gpu/gles2_decoder_helper.h"
......@@ -27,9 +27,8 @@ namespace media {
class MEDIA_GPU_EXPORT D3D11VideoDecoderImpl : public VideoDecoder,
public D3D11VideoDecoderClient {
public:
D3D11VideoDecoderImpl(
base::Callback<gpu::GpuCommandBufferStub*()> get_stub_cb,
OutputWithReleaseMailboxCB output_cb);
D3D11VideoDecoderImpl(base::Callback<gpu::CommandBufferStub*()> get_stub_cb,
OutputWithReleaseMailboxCB output_cb);
~D3D11VideoDecoderImpl() override;
// VideoDecoder implementation:
......@@ -62,8 +61,8 @@ class MEDIA_GPU_EXPORT D3D11VideoDecoderImpl : public VideoDecoder,
void OnMailboxReleased(D3D11PictureBuffer* buffer,
const gpu::SyncToken& sync_token);
base::Callback<gpu::GpuCommandBufferStub*()> get_stub_cb_;
gpu::GpuCommandBufferStub* stub_ = nullptr;
base::Callback<gpu::CommandBufferStub*()> get_stub_cb_;
gpu::CommandBufferStub* stub_ = nullptr;
// A helper for creating textures. Only valid while |stub_| is valid.
std::unique_ptr<GLES2DecoderHelper> decoder_helper_;
......
......@@ -9,7 +9,7 @@ import "media/mojo/interfaces/media_log.mojom";
import "media/mojo/interfaces/media_types.mojom";
import "mojo/common/unguessable_token.mojom";
// Identifies a GpuCommandBufferStub. MediaGpuChannelManager is responsible
// Identifies a CommandBufferStub. MediaGpuChannelManager is responsible
// for minting |channel_token| objects.
struct CommandBufferId {
mojo.common.mojom.UnguessableToken channel_token;
......@@ -22,7 +22,7 @@ struct OverlayInfo;
interface VideoDecoder {
// Initialize the decoder. This must be called before any other method.
//
// |command_buffer_id|, when present, identifies a GpuCommandBufferStub that
// |command_buffer_id|, when present, identifies a CommandBufferStub that
// the decoder can use for GL operations. Implementations that require GL will
// fail Initialize() if |command_buffer_id| is not provided.
//
......
......@@ -62,7 +62,7 @@ std::unique_ptr<MediaDrmStorage> CreateMediaDrmStorage(
#if BUILDFLAG(ENABLE_MEDIA_CODEC_VIDEO_DECODER) || \
BUILDFLAG(ENABLE_D3D11_VIDEO_DECODER)
gpu::GpuCommandBufferStub* GetGpuCommandBufferStub(
gpu::CommandBufferStub* GetCommandBufferStub(
base::WeakPtr<MediaGpuChannelManager> media_gpu_channel_manager,
base::UnguessableToken channel_token,
int32_t route_id) {
......@@ -111,7 +111,7 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
RequestOverlayInfoCB request_overlay_info_cb) {
#if BUILDFLAG(ENABLE_MEDIA_CODEC_VIDEO_DECODER)
auto get_stub_cb =
base::Bind(&GetGpuCommandBufferStub, media_gpu_channel_manager_,
base::Bind(&GetCommandBufferStub, media_gpu_channel_manager_,
command_buffer_id->channel_token, command_buffer_id->route_id);
return base::MakeUnique<MediaCodecVideoDecoder>(
gpu_preferences_, std::move(output_cb), DeviceInfo::GetInstance(),
......@@ -124,7 +124,7 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
#elif BUILDFLAG(ENABLE_D3D11_VIDEO_DECODER)
return base::MakeUnique<D3D11VideoDecoder>(
gpu_task_runner_,
base::Bind(&GetGpuCommandBufferStub, media_gpu_channel_manager_,
base::Bind(&GetCommandBufferStub, media_gpu_channel_manager_,
command_buffer_id->channel_token, command_buffer_id->route_id),
std::move(output_cb));
#else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment