Chromium Code Reviews| Index: gpu/ipc/service/gpu_command_buffer_stub.cc |
| diff --git a/gpu/ipc/service/gpu_command_buffer_stub.cc b/gpu/ipc/service/gpu_command_buffer_stub.cc |
| index 412d9a97182600dd249a90304302123b615ba887..81494b5a7d873f67e74dd04ed69dd8e5e45f4b56 100644 |
| --- a/gpu/ipc/service/gpu_command_buffer_stub.cc |
| +++ b/gpu/ipc/service/gpu_command_buffer_stub.cc |
| @@ -26,6 +26,7 @@ |
| #include "gpu/command_buffer/service/logger.h" |
| #include "gpu/command_buffer/service/mailbox_manager.h" |
| #include "gpu/command_buffer/service/memory_tracking.h" |
| +#include "gpu/command_buffer/service/progress_reporter.h" |
| #include "gpu/command_buffer/service/query_manager.h" |
| #include "gpu/command_buffer/service/sync_point_manager.h" |
| #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| @@ -105,6 +106,24 @@ class GpuCommandBufferMemoryTracker : public gles2::MemoryTracker { |
| DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); |
| }; |
| +// GpuCommandBufferProgressReporter is used as a bridge between the |
| +// ContextGroup and the GpuChannel's GpuWatchdogThread. |
| +class GpuCommandBufferProgressReporter : public gles2::ProgressReporter { |
| + public: |
| + GpuCommandBufferProgressReporter(GpuChannel* channel) : channel_(channel) {} |
| + |
| + void ReportProgress() override { |
| + if (auto* watchdog = channel_->watchdog()) { |
|
danakj
2016/10/05 01:53:48
when is it null?
ericrk
2016/10/05 18:07:32
added stub and removed.
|
| + watchdog->CheckArmed(); |
| + } |
| + } |
| + |
| + private: |
| + // The GpuChannel always outlives the GpuCommandBufferStub and the |
| + // ContextGroups it creates, so it's safe to hold by raw pointer here. |
| + GpuChannel* channel_; |
| +}; |
| + |
| // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the |
| // url_hash matches. |
| void FastSetActiveURL(const GURL& url, size_t url_hash, GpuChannel* channel) { |
| @@ -469,7 +488,8 @@ bool GpuCommandBufferStub::Initialize( |
| manager->shader_translator_cache(), |
| manager->framebuffer_completeness_cache(), feature_info, |
| init_params.attribs.bind_generates_resource, |
| - gmb_factory ? gmb_factory->AsImageFactory() : nullptr); |
| + gmb_factory ? gmb_factory->AsImageFactory() : nullptr, |
| + base::MakeUnique<GpuCommandBufferProgressReporter>(channel_)); |
|
danakj
2016/10/05 01:53:48
I was surprised at the ownership model here. I wou
ericrk
2016/10/05 18:07:31
I agree, this was a weird decision - I was origina
|
| } |
| #if defined(OS_MACOSX) |