| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "content/common/gpu/client/content_gl_context.h" | 14 #include "content/common/gpu/client/content_gl_context.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 19 #include "ui/gfx/gl/gpu_preference.h" | 19 #include "ui/gfx/gl/gpu_preference.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 21 | 21 |
| 22 #if defined(USE_SKIA) | 22 #if defined(USE_SKIA) |
| 23 #define FLIP_FRAMEBUFFER_VERTICALLY | 23 #define FLIP_FRAMEBUFFER_VERTICALLY |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 class GpuChannelHost; | 26 class GpuChannelHost; |
| 27 class GpuChannelHostFactory; |
| 27 | 28 |
| 28 namespace gpu { | 29 namespace gpu { |
| 29 namespace gles2 { | 30 namespace gles2 { |
| 30 class GLES2Implementation; | 31 class GLES2Implementation; |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 | 34 |
| 34 using WebKit::WebGLId; | 35 using WebKit::WebGLId; |
| 35 | 36 |
| 36 using WebKit::WGC3Dchar; | 37 using WebKit::WGC3Dchar; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 virtual void OnViewContextSwapBuffersComplete() = 0; | 55 virtual void OnViewContextSwapBuffersComplete() = 0; |
| 55 virtual void OnViewContextSwapBuffersAborted() = 0; | 56 virtual void OnViewContextSwapBuffersAborted() = 0; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 class WebGraphicsContext3DCommandBufferImpl | 59 class WebGraphicsContext3DCommandBufferImpl |
| 59 : public WebKit::WebGraphicsContext3D { | 60 : public WebKit::WebGraphicsContext3D { |
| 60 public: | 61 public: |
| 61 WebGraphicsContext3DCommandBufferImpl( | 62 WebGraphicsContext3DCommandBufferImpl( |
| 62 int surface_id, | 63 int surface_id, |
| 63 const GURL& active_url, | 64 const GURL& active_url, |
| 65 GpuChannelHostFactory* factory, |
| 64 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client); | 66 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client); |
| 65 virtual ~WebGraphicsContext3DCommandBufferImpl(); | 67 virtual ~WebGraphicsContext3DCommandBufferImpl(); |
| 66 | 68 |
| 67 bool Initialize(const Attributes& attributes); | 69 bool Initialize(const Attributes& attributes); |
| 68 | 70 |
| 69 //---------------------------------------------------------------------- | 71 //---------------------------------------------------------------------- |
| 70 // WebGraphicsContext3D methods | 72 // WebGraphicsContext3D methods |
| 71 | 73 |
| 72 // Must be called after initialize() and before any of the following methods. | 74 // Must be called after initialize() and before any of the following methods. |
| 73 // Permanently binds to the first calling thread. Returns false if the | 75 // Permanently binds to the first calling thread. Returns false if the |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 504 |
| 503 // Check if we should call into the swap client. We can only do that on the | 505 // Check if we should call into the swap client. We can only do that on the |
| 504 // main thread. | 506 // main thread. |
| 505 bool ShouldUseSwapClient(); | 507 bool ShouldUseSwapClient(); |
| 506 | 508 |
| 507 // MemoryAllocationChanged callback. | 509 // MemoryAllocationChanged callback. |
| 508 void OnMemoryAllocationChanged(const GpuMemoryAllocation& allocation); | 510 void OnMemoryAllocationChanged(const GpuMemoryAllocation& allocation); |
| 509 | 511 |
| 510 bool initialize_failed_; | 512 bool initialize_failed_; |
| 511 | 513 |
| 514 // The channel factory to talk to the GPU process |
| 515 GpuChannelHostFactory* factory_; |
| 516 |
| 512 // The context we use for OpenGL rendering. | 517 // The context we use for OpenGL rendering. |
| 513 ContentGLContext* context_; | 518 ContentGLContext* context_; |
| 514 // The GLES2Implementation we use for OpenGL rendering. | 519 // The GLES2Implementation we use for OpenGL rendering. |
| 515 gpu::gles2::GLES2Implementation* gl_; | 520 gpu::gles2::GLES2Implementation* gl_; |
| 516 | 521 |
| 517 // State needed by MaybeInitializeGL. | 522 // State needed by MaybeInitializeGL. |
| 518 GpuChannelHost* host_; | 523 GpuChannelHost* host_; |
| 519 int32 surface_id_; | 524 int32 surface_id_; |
| 520 GURL active_url_; | 525 GURL active_url_; |
| 521 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client_; | 526 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 546 | 551 |
| 547 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 552 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
| 548 std::vector<uint8> scanline_; | 553 std::vector<uint8> scanline_; |
| 549 void FlipVertically(uint8* framebuffer, | 554 void FlipVertically(uint8* framebuffer, |
| 550 unsigned int width, | 555 unsigned int width, |
| 551 unsigned int height); | 556 unsigned int height); |
| 552 #endif | 557 #endif |
| 553 }; | 558 }; |
| 554 | 559 |
| 555 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 560 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| OLD | NEW |