Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "android_webview/browser/gpu_memory_buffer_factory_impl.h" | 5 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/gpu_memory_buffer_impl.h" | 7 #include "android_webview/browser/gpu_memory_buffer_impl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "gpu/command_buffer/client/gpu_memory_buffer_factory.h" | |
| 11 #include "gpu/command_buffer/service/image_manager.h" | |
| 9 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 #include "ui/gl/gl_image.h" | |
| 10 | 14 |
| 11 namespace android_webview { | 15 namespace android_webview { |
| 12 | 16 |
| 13 scoped_ptr<gpu::GpuMemoryBuffer> CreateGpuMemoryBuffer(int width, int height) { | 17 scoped_ptr<gpu::GpuMemoryBuffer> CreateGpuMemoryBuffer( |
| 18 int buffer_id, int width, int height) { | |
| 14 DCHECK(width > 0); | 19 DCHECK(width > 0); |
| 15 DCHECK(height > 0); | 20 DCHECK(height > 0); |
| 16 scoped_ptr<GpuMemoryBufferImpl> result(new GpuMemoryBufferImpl( | 21 gfx::Size size(width, height); |
| 17 gfx::Size(width, height))); | 22 |
| 23 scoped_ptr<GpuMemoryBufferImpl> result(new GpuMemoryBufferImpl(size)); | |
| 24 | |
| 25 scoped_refptr<gfx::GLImage> gl_image = | |
| 26 gfx::GLImage::CreateGLImageForGpuMemoryBuffer( | |
| 27 result->GetNativeBuffer(), size); | |
| 28 | |
| 29 DCHECK(buffer_id != 0); | |
| 30 gpu::GetProcessDefaultImageManager()->AddImage(gl_image, buffer_id); | |
|
joth
2013/04/29 17:21:21
Is there a RemoveImage() call? where does that hap
kaanb
2013/04/30 03:40:10
Let's discuss this when sievers@ comes back.
| |
| 18 return result.PassAs<gpu::GpuMemoryBuffer>(); | 31 return result.PassAs<gpu::GpuMemoryBuffer>(); |
| 19 } | 32 } |
| 20 | 33 |
| 21 } // namespace android_webview | 34 } // namespace android_webview |
| OLD | NEW |