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

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

Issue 7860028: Retry 3 to split WebGraphicsContext3DCommandBufferImpl::initialize() into two stages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fold thread fixes into this patch. 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.
61 virtual bool makeContextCurrent(); 65 virtual bool makeContextCurrent();
62 66
63 virtual int width(); 67 virtual int width();
64 virtual int height(); 68 virtual int height();
65 69
66 virtual bool isGLES2Compliant(); 70 virtual bool isGLES2Compliant();
67 71
68 virtual bool setParentContext(WebGraphicsContext3D* parent_context); 72 virtual bool setParentContext(WebGraphicsContext3D* parent_context);
69 73
70 virtual void reshape(int width, int height); 74 virtual void reshape(int width, int height);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 virtual void setSwapBuffersCompleteCallbackCHROMIUM( 434 virtual void setSwapBuffersCompleteCallbackCHROMIUM(
431 WebGraphicsContext3D:: 435 WebGraphicsContext3D::
432 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); 436 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback);
433 437
434 protected: 438 protected:
435 #if WEBKIT_USING_SKIA 439 #if WEBKIT_USING_SKIA
436 virtual GrGLInterface* onCreateGrGLInterface(); 440 virtual GrGLInterface* onCreateGrGLInterface();
437 #endif 441 #endif
438 442
439 private: 443 private:
444 // Initialize the underlying GL context. May be called multiple times; second
445 // and subsequent calls are ignored. Must be called from the thread that is
446 // going to use this object to issue GL commands (which might not be the main
447 // thread).
448 bool MaybeInitializeGL();
449
440 // SwapBuffers callback. 450 // SwapBuffers callback.
441 void OnSwapBuffersComplete(); 451 void OnSwapBuffersComplete();
442 virtual void OnContextLost(RendererGLContext::ContextLostReason reason); 452 virtual void OnContextLost(RendererGLContext::ContextLostReason reason);
443 453
454 bool initialize_failed_;
455
444 // The context we use for OpenGL rendering. 456 // The context we use for OpenGL rendering.
445 RendererGLContext* context_; 457 RendererGLContext* context_;
446 // The GLES2Implementation we use for OpenGL rendering. 458 // The GLES2Implementation we use for OpenGL rendering.
447 gpu::gles2::GLES2Implementation* gl_; 459 gpu::gles2::GLES2Implementation* gl_;
448 460
461 // State needed by MaybeInitializeGL.
462 GpuChannelHost* host_;
463 GURL active_url_;
464 int32 render_view_routing_id_;
465
449 bool render_directly_to_web_view_; 466 bool render_directly_to_web_view_;
450 #ifndef WTF_USE_THREADED_COMPOSITING 467 #ifndef WTF_USE_THREADED_COMPOSITING
451 // If rendering directly to WebView, weak pointer to it. 468 // If rendering directly to WebView, weak pointer to it.
452 WebKit::WebView* web_view_; 469 WebKit::WebView* web_view_;
453 #endif 470 #endif
454 #if defined(OS_MACOSX) 471 #if defined(OS_MACOSX)
455 // "Fake" plugin window handle in browser process for the compositor's output. 472 // "Fake" plugin window handle in browser process for the compositor's output.
456 gfx::PluginWindowHandle plugin_handle_; 473 gfx::PluginWindowHandle plugin_handle_;
457 #endif 474 #endif
458 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; 475 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
(...skipping 17 matching lines...) Expand all
476 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 493 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
477 scoped_array<uint8> scanline_; 494 scoped_array<uint8> scanline_;
478 void FlipVertically(uint8* framebuffer, 495 void FlipVertically(uint8* framebuffer,
479 unsigned int width, 496 unsigned int width,
480 unsigned int height); 497 unsigned int height);
481 #endif 498 #endif
482 }; 499 };
483 500
484 #endif // defined(ENABLE_GPU) 501 #endif // defined(ENABLE_GPU)
485 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ 502 #endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/gpu/transport_texture_service.h ('k') | content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698