 Chromium Code Reviews
 Chromium Code Reviews Issue 2257533006:
  Free worker context resources on idle.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@fix-cleanup2
    
  
    Issue 2257533006:
  Free worker context resources on idle.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@fix-cleanup2| Index: gpu/command_buffer/client/gles2_implementation.h | 
| diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h | 
| index 0d6dffcf4e71ad7e33fddb3f0944246de04eb8cf..22c9cc52a18d6ff4df84c02832fc51061ae68b86 100644 | 
| --- a/gpu/command_buffer/client/gles2_implementation.h | 
| +++ b/gpu/command_buffer/client/gles2_implementation.h | 
| @@ -17,6 +17,7 @@ | 
| #include <utility> | 
| #include <vector> | 
| +#include "base/cancelable_callback.h" | 
| #include "base/compiler_specific.h" | 
| #include "base/macros.h" | 
| #include "base/memory/weak_ptr.h" | 
| @@ -211,6 +212,12 @@ class GLES2_IMPL_EXPORT GLES2Implementation | 
| std::unique_ptr<ScopedVisibility> visibility) override; | 
| bool AnyClientsVisible() const override; | 
| + std::unique_ptr<ScopedBusy> ClientBecameBusy() override; | 
| + void ClientBecameNotBusy(std::unique_ptr<ScopedBusy> busy) override; | 
| + void SetIdleCallback(const base::Closure& callback, | 
| + scoped_refptr<base::SingleThreadTaskRunner> | 
| + callback_task_runner) override; | 
| + | 
| // TODO(danakj): Move to ContextSupport once ContextProvider doesn't need to | 
| // intercept it. | 
| void SetLostContextCallback(const base::Closure& callback); | 
| @@ -261,6 +268,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation | 
| const base::Closure& callback) override; | 
| void SignalQuery(uint32_t query, const base::Closure& callback) override; | 
| void SetAggressivelyFreeResources(bool aggressively_free_resources) override; | 
| + void TrimResources() override; | 
| // base::trace_event::MemoryDumpProvider implementation. | 
| bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 
| @@ -695,6 +703,9 @@ class GLES2_IMPL_EXPORT GLES2Implementation | 
| PixelStoreParams GetUnpackParameters(Dimension dimension); | 
| + void ScheduleIdleCallback(); | 
| + void CancelIdleCallback(); | 
| + | 
| GLES2Util util_; | 
| GLES2CmdHelper* helper_; | 
| TransferBufferInterface* transfer_buffer_; | 
| @@ -822,6 +833,11 @@ class GLES2_IMPL_EXPORT GLES2Implementation | 
| base::Closure lost_context_callback_; | 
| bool lost_context_callback_run_ = false; | 
| + base::Closure idle_callback_; | 
| + std::unique_ptr<base::CancelableClosure> pending_idle_callback_; | 
| 
danakj
2016/08/23 01:26:25
why unique_ptr it?
 
ericrk
2016/08/24 18:32:21
You must create a CancelableClosure on the same th
 | 
| + scoped_refptr<base::SingleThreadTaskRunner> idle_callback_task_runner_; | 
| + bool is_idle_ = true; | 
| + | 
| int current_trace_stack_; | 
| GpuControl* gpu_control_; |