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

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

Issue 7828046: Reland 98392 - Split WebGraphicsContext3DCommandBufferImpl::initialize() into two stages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 "base/task.h" 14 #include "base/task.h"
15 #include "content/renderer/gpu/renderer_gl_context.h" 15 #include "content/renderer/gpu/renderer_gl_context.h"
16 #include "googleurl/src/gurl.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D. h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
19 #include "ui/gfx/native_widget_types.h" 20 #include "ui/gfx/native_widget_types.h"
20 21
21 #if !defined(OS_MACOSX) 22 #if !defined(OS_MACOSX)
22 #define FLIP_FRAMEBUFFER_VERTICALLY 23 #define FLIP_FRAMEBUFFER_VERTICALLY
23 #endif 24 #endif
24 25
25 class GpuChannelHost; 26 class GpuChannelHost;
(...skipping 25 matching lines...) Expand all
51 52
52 WebGraphicsContext3DCommandBufferImpl(); 53 WebGraphicsContext3DCommandBufferImpl();
53 virtual ~WebGraphicsContext3DCommandBufferImpl(); 54 virtual ~WebGraphicsContext3DCommandBufferImpl();
54 55
55 //---------------------------------------------------------------------- 56 //----------------------------------------------------------------------
56 // WebGraphicsContext3D methods 57 // WebGraphicsContext3D methods
57 virtual bool initialize(WebGraphicsContext3D::Attributes attributes, 58 virtual bool initialize(WebGraphicsContext3D::Attributes attributes,
58 WebKit::WebView*, 59 WebKit::WebView*,
59 bool renderDirectlyToWebView); 60 bool renderDirectlyToWebView);
60 61
62 // Must be called after initialize() and before any of the following methods.
63 // Permanently binds to the first calling thread. Returns false if the
64 // graphics context fails to create. Do not call from more than one thread.
65 // TODO(husky): Document threading restrictions in WebGraphicsContext3D.h,
66 // enforce strictly in all implementations.
61 virtual bool makeContextCurrent(); 67 virtual bool makeContextCurrent();
62 68
63 virtual int width(); 69 virtual int width();
64 virtual int height(); 70 virtual int height();
65 71
66 virtual bool isGLES2Compliant(); 72 virtual bool isGLES2Compliant();
67 73
68 virtual bool setParentContext(WebGraphicsContext3D* parent_context); 74 virtual bool setParentContext(WebGraphicsContext3D* parent_context);
69 75
70 virtual void reshape(int width, int height); 76 virtual void reshape(int width, int height);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 435
430 virtual void setSwapBuffersCompleteCallbackCHROMIUM( 436 virtual void setSwapBuffersCompleteCallbackCHROMIUM(
431 WebGraphicsContext3D:: 437 WebGraphicsContext3D::
432 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); 438 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback);
433 439
434 #if WEBKIT_USING_SKIA 440 #if WEBKIT_USING_SKIA
435 virtual GrGLInterface* grGLInterface(); 441 virtual GrGLInterface* grGLInterface();
436 #endif 442 #endif
437 443
438 private: 444 private:
445 // Initialize the underlying GL context. May be called multiple times; second
446 // and subsequent calls are ignored. Must be called from the thread that is
447 // going to use this object to issue GL commands (which might not be the main
448 // thread).
449 bool MaybeInitializeGL();
450
439 // SwapBuffers callback. 451 // SwapBuffers callback.
440 void OnSwapBuffersComplete(); 452 void OnSwapBuffersComplete();
441 virtual void OnContextLost(RendererGLContext::ContextLostReason reason); 453 virtual void OnContextLost(RendererGLContext::ContextLostReason reason);
442 454
443 // The context we use for OpenGL rendering. 455 // The context we use for OpenGL rendering.
444 RendererGLContext* context_; 456 RendererGLContext* context_;
445 // The GLES2Implementation we use for OpenGL rendering. 457 // The GLES2Implementation we use for OpenGL rendering.
446 gpu::gles2::GLES2Implementation* gl_; 458 gpu::gles2::GLES2Implementation* gl_;
447 459
460 // State needed by MaybeInitializeGL.
461 GpuChannelHost* host_;
462 GURL active_url_;
463 int32 render_view_routing_id_;
464
448 bool render_directly_to_web_view_; 465 bool render_directly_to_web_view_;
449 #ifndef WTF_USE_THREADED_COMPOSITING 466 #ifndef WTF_USE_THREADED_COMPOSITING
450 // If rendering directly to WebView, weak pointer to it. 467 // If rendering directly to WebView, weak pointer to it.
451 WebKit::WebView* web_view_; 468 WebKit::WebView* web_view_;
452 #endif 469 #endif
453 #if defined(OS_MACOSX) 470 #if defined(OS_MACOSX)
454 // "Fake" plugin window handle in browser process for the compositor's output. 471 // "Fake" plugin window handle in browser process for the compositor's output.
455 gfx::PluginWindowHandle plugin_handle_; 472 gfx::PluginWindowHandle plugin_handle_;
456 #endif 473 #endif
457 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; 474 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
(...skipping 17 matching lines...) Expand all
475 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 492 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
476 scoped_array<uint8> scanline_; 493 scoped_array<uint8> scanline_;
477 void FlipVertically(uint8* framebuffer, 494 void FlipVertically(uint8* framebuffer,
478 unsigned int width, 495 unsigned int width,
479 unsigned int height); 496 unsigned int height);
480 #endif 497 #endif
481 }; 498 };
482 499
483 #endif // defined(ENABLE_GPU) 500 #endif // defined(ENABLE_GPU)
484 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ 501 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/gpu/renderer_gl_context.cc ('k') | content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698