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 3// found in the LICENSE file. 4 5#ifndef ANDROID_WEBVIEW_BROWSER_GPU_MEMORY_BUFFER_FACTORY_IMPL_H_ 6#define ANDROID_WEBVIEW_BROWSER_GPU_MEMORY_BUFFER_FACTORY_IMPL_H_ 7 8#include "base/basictypes.h" 9#include "base/compiler_specific.h" 10#include "gpu/command_buffer/service/in_process_command_buffer.h" 11 12struct AwDrawGLFunctionTable; 13 14namespace android_webview { 15 16class GpuMemoryBufferFactoryImpl : public gpu::InProcessGpuMemoryBufferFactory { 17 public: 18 GpuMemoryBufferFactoryImpl(); 19 virtual ~GpuMemoryBufferFactoryImpl(); 20 21 static void SetAwDrawGLFunctionTable(AwDrawGLFunctionTable* table); 22 bool Initialize(); 23 24 // Overridden from gpu::InProcessGpuMemoryBufferFactory: 25 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( 26 size_t width, 27 size_t height, 28 unsigned internalformat, 29 unsigned usage) OVERRIDE; 30 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( 31 const gfx::GpuMemoryBufferHandle& handle, 32 const gfx::Size& size, 33 unsigned internalformat) OVERRIDE; 34 35 private: 36 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryImpl); 37}; 38 39} // namespace android_webview 40 41#endif // ANDROID_WEBVIEW_BROWSER_GPU_MEMORY_BUFFER_FACTORY_IMPL_H_ 42