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

Side by Side Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h

Issue 12908004: Lazy initialize WGC3DInProcessCommandBufferImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: explicit constructor Created 7 years, 8 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) 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 WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ 5 #ifndef WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ 6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
7 7
8 #if defined(ENABLE_GPU) 8 #if defined(ENABLE_GPU)
9 9
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 39
40 namespace webkit { 40 namespace webkit {
41 namespace gpu { 41 namespace gpu {
42 42
43 class GLInProcessContext; 43 class GLInProcessContext;
44 44
45 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl 45 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
46 : public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) { 46 : public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) {
47 public: 47 public:
48 48
49 WebGraphicsContext3DInProcessCommandBufferImpl(); 49 explicit WebGraphicsContext3DInProcessCommandBufferImpl(
50 const WebKit::WebGraphicsContext3D::Attributes& attributes);
50 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); 51 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl();
51 52
52 bool Initialize(WebKit::WebGraphicsContext3D::Attributes attributes,
53 WebKit::WebGraphicsContext3D* view_context);
54
55 //---------------------------------------------------------------------- 53 //----------------------------------------------------------------------
56 // WebGraphicsContext3D methods 54 // WebGraphicsContext3D methods
57 virtual bool makeContextCurrent(); 55 virtual bool makeContextCurrent();
58 56
59 virtual int width(); 57 virtual int width();
60 virtual int height(); 58 virtual int height();
61 59
62 virtual bool isGLES2Compliant(); 60 virtual bool isGLES2Compliant();
63 61
64 virtual bool setParentContext(WebGraphicsContext3D* parent_context); 62 virtual bool setParentContext(WebGraphicsContext3D* parent_context);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs); 523 virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs);
526 524
527 protected: 525 protected:
528 virtual GrGLInterface* onCreateGrGLInterface(); 526 virtual GrGLInterface* onCreateGrGLInterface();
529 527
530 private: 528 private:
531 // SwapBuffers callback. 529 // SwapBuffers callback.
532 void OnSwapBuffersComplete(); 530 void OnSwapBuffersComplete();
533 virtual void OnContextLost(); 531 virtual void OnContextLost();
534 532
533 bool MaybeInitializeGL();
534
535 // Used to try to find bugs in code that calls gl directly through the gl api 535 // Used to try to find bugs in code that calls gl directly through the gl api
536 // instead of going through WebGraphicsContext3D. 536 // instead of going through WebGraphicsContext3D.
537 void ClearContext(); 537 void ClearContext();
538 538
539 bool initialized_;
540 bool initialize_failed_;
541
539 // The context we use for OpenGL rendering. 542 // The context we use for OpenGL rendering.
540 GLInProcessContext* context_; 543 GLInProcessContext* context_;
541 // The GLES2Implementation we use for OpenGL rendering. 544 // The GLES2Implementation we use for OpenGL rendering.
542 ::gpu::gles2::GLES2Implementation* gl_; 545 ::gpu::gles2::GLES2Implementation* gl_;
543 546
544 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; 547 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
545 WGC3Denum context_lost_reason_; 548 WGC3Denum context_lost_reason_;
546 549
547 WebKit::WebGraphicsContext3D::Attributes attributes_; 550 WebKit::WebGraphicsContext3D::Attributes attributes_;
548 int cached_width_, cached_height_; 551 int cached_width_, cached_height_;
549 552
550 // For tracking which FBO is bound. 553 // For tracking which FBO is bound.
551 WebGLId bound_fbo_; 554 WebGLId bound_fbo_;
552 555
553 // Errors raised by synthesizeGLError(). 556 // Errors raised by synthesizeGLError().
554 std::vector<WGC3Denum> synthetic_errors_; 557 std::vector<WGC3Denum> synthetic_errors_;
555 558
556 std::vector<uint8> scanline_; 559 std::vector<uint8> scanline_;
557 void FlipVertically(uint8* framebuffer, 560 void FlipVertically(uint8* framebuffer,
558 unsigned int width, 561 unsigned int width,
559 unsigned int height); 562 unsigned int height);
560 }; 563 };
561 564
562 } // namespace gpu 565 } // namespace gpu
563 } // namespace webkit 566 } // namespace webkit
564 567
565 #endif // defined(ENABLE_GPU) 568 #endif // defined(ENABLE_GPU)
566 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ 569 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/gpu/context_provider_in_process.cc ('k') | webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698