OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/client/context_provider_command_buffer.h" | 5 #include "content/common/gpu/client/context_provider_command_buffer.h" |
6 | 6 |
7 #include "webkit/gpu/grcontext_for_webgraphicscontext3d.h" | 7 #include "webkit/gpu/grcontext_for_webgraphicscontext3d.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 class ContextProviderCommandBuffer::MemoryAllocationCallbackProxy | 27 class ContextProviderCommandBuffer::MemoryAllocationCallbackProxy |
28 : public WebKit::WebGraphicsContext3D:: | 28 : public WebKit::WebGraphicsContext3D:: |
29 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM { | 29 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM { |
30 public: | 30 public: |
31 explicit MemoryAllocationCallbackProxy(ContextProviderCommandBuffer* provider) | 31 explicit MemoryAllocationCallbackProxy(ContextProviderCommandBuffer* provider) |
32 : provider_(provider) { | 32 : provider_(provider) { |
33 provider_->context3d_->setMemoryAllocationChangedCallbackCHROMIUM(this); | 33 provider_->context3d_->setMemoryAllocationChangedCallbackCHROMIUM(this); |
34 } | 34 } |
35 | 35 |
36 void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation alloc) { | 36 virtual void onMemoryAllocationChanged( |
| 37 WebKit::WebGraphicsMemoryAllocation alloc) { |
37 provider_->OnMemoryAllocationChanged(!!alloc.gpuResourceSizeInBytes); | 38 provider_->OnMemoryAllocationChanged(!!alloc.gpuResourceSizeInBytes); |
38 } | 39 } |
39 | 40 |
40 private: | 41 private: |
41 ContextProviderCommandBuffer* provider_; | 42 ContextProviderCommandBuffer* provider_; |
42 }; | 43 }; |
43 | 44 |
44 ContextProviderCommandBuffer::ContextProviderCommandBuffer() | 45 ContextProviderCommandBuffer::ContextProviderCommandBuffer() |
45 : leak_on_destroy_(false), | 46 : leak_on_destroy_(false), |
46 destroyed_(false) { | 47 destroyed_(false) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return destroyed_; | 110 return destroyed_; |
110 } | 111 } |
111 | 112 |
112 void ContextProviderCommandBuffer::OnMemoryAllocationChanged( | 113 void ContextProviderCommandBuffer::OnMemoryAllocationChanged( |
113 bool nonzero_allocation) { | 114 bool nonzero_allocation) { |
114 if (gr_context_) | 115 if (gr_context_) |
115 gr_context_->SetMemoryLimit(nonzero_allocation); | 116 gr_context_->SetMemoryLimit(nonzero_allocation); |
116 } | 117 } |
117 | 118 |
118 } // namespace content | 119 } // namespace content |
OLD | NEW |