| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "content/renderer/gpu/renderer_gl_context.h" | 14 #include "content/renderer/gpu/renderer_gl_context.h" |
| 15 #include "googleurl/src/gurl.h" | |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 20 | 19 |
| 21 #if !defined(OS_MACOSX) | 20 #if !defined(OS_MACOSX) |
| 22 #define FLIP_FRAMEBUFFER_VERTICALLY | 21 #define FLIP_FRAMEBUFFER_VERTICALLY |
| 23 #endif | 22 #endif |
| 24 | 23 |
| 25 class GpuChannelHost; | 24 class GpuChannelHost; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 | 50 |
| 52 WebGraphicsContext3DCommandBufferImpl(); | 51 WebGraphicsContext3DCommandBufferImpl(); |
| 53 virtual ~WebGraphicsContext3DCommandBufferImpl(); | 52 virtual ~WebGraphicsContext3DCommandBufferImpl(); |
| 54 | 53 |
| 55 //---------------------------------------------------------------------- | 54 //---------------------------------------------------------------------- |
| 56 // WebGraphicsContext3D methods | 55 // WebGraphicsContext3D methods |
| 57 virtual bool initialize(WebGraphicsContext3D::Attributes attributes, | 56 virtual bool initialize(WebGraphicsContext3D::Attributes attributes, |
| 58 WebKit::WebView*, | 57 WebKit::WebView*, |
| 59 bool renderDirectlyToWebView); | 58 bool renderDirectlyToWebView); |
| 60 | 59 |
| 61 // Must be called after initialize() and before any of the following methods. | |
| 62 // Binds this object to the current thread. We can't bind to multiple threads. | |
| 63 // TODO(husky): Document threading restrictions in WebGraphicsContext3D.h, | |
| 64 // enforce strictly in all implementations. | |
| 65 virtual bool makeContextCurrent(); | 60 virtual bool makeContextCurrent(); |
| 66 | 61 |
| 67 virtual int width(); | 62 virtual int width(); |
| 68 virtual int height(); | 63 virtual int height(); |
| 69 | 64 |
| 70 virtual bool isGLES2Compliant(); | 65 virtual bool isGLES2Compliant(); |
| 71 | 66 |
| 72 virtual bool setParentContext(WebGraphicsContext3D* parent_context); | 67 virtual bool setParentContext(WebGraphicsContext3D* parent_context); |
| 73 | 68 |
| 74 virtual void reshape(int width, int height); | 69 virtual void reshape(int width, int height); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 424 |
| 430 virtual void setContextLostCallback( | 425 virtual void setContextLostCallback( |
| 431 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); | 426 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); |
| 432 virtual WGC3Denum getGraphicsResetStatusARB(); | 427 virtual WGC3Denum getGraphicsResetStatusARB(); |
| 433 | 428 |
| 434 virtual void setSwapBuffersCompleteCallbackCHROMIUM( | 429 virtual void setSwapBuffersCompleteCallbackCHROMIUM( |
| 435 WebGraphicsContext3D:: | 430 WebGraphicsContext3D:: |
| 436 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); | 431 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); |
| 437 | 432 |
| 438 private: | 433 private: |
| 439 // Initialize the underlying GL context. May be called multiple times; second | |
| 440 // and subsequent calls are ignored. Must be called from the thread that is | |
| 441 // going to use this object to issue GL commands (which might not be the main | |
| 442 // thread). | |
| 443 bool MaybeInitializeGL(); | |
| 444 | |
| 445 // SwapBuffers callback. | 434 // SwapBuffers callback. |
| 446 void OnSwapBuffersComplete(); | 435 void OnSwapBuffersComplete(); |
| 447 virtual void OnContextLost(RendererGLContext::ContextLostReason reason); | 436 virtual void OnContextLost(RendererGLContext::ContextLostReason reason); |
| 448 | 437 |
| 449 // The context we use for OpenGL rendering. | 438 // The context we use for OpenGL rendering. |
| 450 RendererGLContext* context_; | 439 RendererGLContext* context_; |
| 451 // The GLES2Implementation we use for OpenGL rendering. | 440 // The GLES2Implementation we use for OpenGL rendering. |
| 452 gpu::gles2::GLES2Implementation* gl_; | 441 gpu::gles2::GLES2Implementation* gl_; |
| 453 | 442 |
| 454 // State needed by InitializeGLES2. | |
| 455 GpuChannelHost* host_; | |
| 456 GURL active_url_; | |
| 457 int32 render_view_routing_id_; | |
| 458 | |
| 459 bool render_directly_to_web_view_; | 443 bool render_directly_to_web_view_; |
| 460 #ifndef WTF_USE_THREADED_COMPOSITING | 444 #ifndef WTF_USE_THREADED_COMPOSITING |
| 461 // If rendering directly to WebView, weak pointer to it. | 445 // If rendering directly to WebView, weak pointer to it. |
| 462 WebKit::WebView* web_view_; | 446 WebKit::WebView* web_view_; |
| 463 #endif | 447 #endif |
| 464 #if defined(OS_MACOSX) | 448 #if defined(OS_MACOSX) |
| 465 // "Fake" plugin window handle in browser process for the compositor's output. | 449 // "Fake" plugin window handle in browser process for the compositor's output. |
| 466 gfx::PluginWindowHandle plugin_handle_; | 450 gfx::PluginWindowHandle plugin_handle_; |
| 467 #endif | 451 #endif |
| 468 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 452 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 483 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 467 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
| 484 scoped_array<uint8> scanline_; | 468 scoped_array<uint8> scanline_; |
| 485 void FlipVertically(uint8* framebuffer, | 469 void FlipVertically(uint8* framebuffer, |
| 486 unsigned int width, | 470 unsigned int width, |
| 487 unsigned int height); | 471 unsigned int height); |
| 488 #endif | 472 #endif |
| 489 }; | 473 }; |
| 490 | 474 |
| 491 #endif // defined(ENABLE_GPU) | 475 #endif // defined(ENABLE_GPU) |
| 492 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 476 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| OLD | NEW |