Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h

Issue 7713015: Split WebGraphicsContext3DCommandBufferImpl::initialize() into two stages. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Moved asserts to RendererGLContext Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
18 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
19 20
20 #if !defined(OS_MACOSX) 21 #if !defined(OS_MACOSX)
21 #define FLIP_FRAMEBUFFER_VERTICALLY 22 #define FLIP_FRAMEBUFFER_VERTICALLY
22 #endif 23 #endif
23 24
24 class GpuChannelHost; 25 class GpuChannelHost;
(...skipping 25 matching lines...) Expand all
50 51
51 WebGraphicsContext3DCommandBufferImpl(); 52 WebGraphicsContext3DCommandBufferImpl();
52 virtual ~WebGraphicsContext3DCommandBufferImpl(); 53 virtual ~WebGraphicsContext3DCommandBufferImpl();
53 54
54 //---------------------------------------------------------------------- 55 //----------------------------------------------------------------------
55 // WebGraphicsContext3D methods 56 // WebGraphicsContext3D methods
56 virtual bool initialize(WebGraphicsContext3D::Attributes attributes, 57 virtual bool initialize(WebGraphicsContext3D::Attributes attributes,
57 WebKit::WebView*, 58 WebKit::WebView*,
58 bool renderDirectlyToWebView); 59 bool renderDirectlyToWebView);
59 60
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.
60 virtual bool makeContextCurrent(); 65 virtual bool makeContextCurrent();
61 66
62 virtual int width(); 67 virtual int width();
63 virtual int height(); 68 virtual int height();
64 69
65 virtual bool isGLES2Compliant(); 70 virtual bool isGLES2Compliant();
66 71
67 virtual bool setParentContext(WebGraphicsContext3D* parent_context); 72 virtual bool setParentContext(WebGraphicsContext3D* parent_context);
68 73
69 virtual void reshape(int width, int height); 74 virtual void reshape(int width, int height);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 429
425 virtual void setContextLostCallback( 430 virtual void setContextLostCallback(
426 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); 431 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback);
427 virtual WGC3Denum getGraphicsResetStatusARB(); 432 virtual WGC3Denum getGraphicsResetStatusARB();
428 433
429 virtual void setSwapBuffersCompleteCallbackCHROMIUM( 434 virtual void setSwapBuffersCompleteCallbackCHROMIUM(
430 WebGraphicsContext3D:: 435 WebGraphicsContext3D::
431 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); 436 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback);
432 437
433 private: 438 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
434 // SwapBuffers callback. 445 // SwapBuffers callback.
435 void OnSwapBuffersComplete(); 446 void OnSwapBuffersComplete();
436 virtual void OnContextLost(RendererGLContext::ContextLostReason reason); 447 virtual void OnContextLost(RendererGLContext::ContextLostReason reason);
437 448
438 // The context we use for OpenGL rendering. 449 // The context we use for OpenGL rendering.
439 RendererGLContext* context_; 450 RendererGLContext* context_;
440 // The GLES2Implementation we use for OpenGL rendering. 451 // The GLES2Implementation we use for OpenGL rendering.
441 gpu::gles2::GLES2Implementation* gl_; 452 gpu::gles2::GLES2Implementation* gl_;
442 453
454 // State needed by InitializeGLES2.
455 GpuChannelHost* host_;
456 GURL active_url_;
457 int32 render_view_routing_id_;
458
443 bool render_directly_to_web_view_; 459 bool render_directly_to_web_view_;
444 #ifndef WTF_USE_THREADED_COMPOSITING 460 #ifndef WTF_USE_THREADED_COMPOSITING
445 // If rendering directly to WebView, weak pointer to it. 461 // If rendering directly to WebView, weak pointer to it.
446 WebKit::WebView* web_view_; 462 WebKit::WebView* web_view_;
447 #endif 463 #endif
448 #if defined(OS_MACOSX) 464 #if defined(OS_MACOSX)
449 // "Fake" plugin window handle in browser process for the compositor's output. 465 // "Fake" plugin window handle in browser process for the compositor's output.
450 gfx::PluginWindowHandle plugin_handle_; 466 gfx::PluginWindowHandle plugin_handle_;
451 #endif 467 #endif
452 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; 468 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
(...skipping 14 matching lines...) Expand all
467 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 483 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
468 scoped_array<uint8> scanline_; 484 scoped_array<uint8> scanline_;
469 void FlipVertically(uint8* framebuffer, 485 void FlipVertically(uint8* framebuffer,
470 unsigned int width, 486 unsigned int width,
471 unsigned int height); 487 unsigned int height);
472 #endif 488 #endif
473 }; 489 };
474 490
475 #endif // defined(ENABLE_GPU) 491 #endif // defined(ENABLE_GPU)
476 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ 492 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698