OLD | NEW |
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 CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // TODO(piman): move this logic to the compositor and remove it from the | 49 // TODO(piman): move this logic to the compositor and remove it from the |
50 // context... | 50 // context... |
51 class WebGraphicsContext3DSwapBuffersClient { | 51 class WebGraphicsContext3DSwapBuffersClient { |
52 public: | 52 public: |
53 virtual ~WebGraphicsContext3DSwapBuffersClient() { } | 53 virtual ~WebGraphicsContext3DSwapBuffersClient() { } |
54 virtual void OnViewContextSwapBuffersPosted() = 0; | 54 virtual void OnViewContextSwapBuffersPosted() = 0; |
55 virtual void OnViewContextSwapBuffersComplete() = 0; | 55 virtual void OnViewContextSwapBuffersComplete() = 0; |
56 virtual void OnViewContextSwapBuffersAborted() = 0; | 56 virtual void OnViewContextSwapBuffersAborted() = 0; |
57 }; | 57 }; |
58 | 58 |
| 59 class WebGraphicsContext3DErrorMessageCallback; |
| 60 |
59 class WebGraphicsContext3DCommandBufferImpl | 61 class WebGraphicsContext3DCommandBufferImpl |
60 : public WebKit::WebGraphicsContext3D { | 62 : public WebKit::WebGraphicsContext3D { |
61 public: | 63 public: |
62 WebGraphicsContext3DCommandBufferImpl( | 64 WebGraphicsContext3DCommandBufferImpl( |
63 int surface_id, | 65 int surface_id, |
64 const GURL& active_url, | 66 const GURL& active_url, |
65 GpuChannelHostFactory* factory, | 67 GpuChannelHostFactory* factory, |
66 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client); | 68 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client); |
67 virtual ~WebGraphicsContext3DCommandBufferImpl(); | 69 virtual ~WebGraphicsContext3DCommandBufferImpl(); |
68 | 70 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 WebGLId query, WGC3Denum pname, WGC3Duint* params); | 496 WebGLId query, WGC3Denum pname, WGC3Duint* params); |
495 | 497 |
496 ContentGLContext* content_gl_context() const { return context_; } | 498 ContentGLContext* content_gl_context() const { return context_; } |
497 | 499 |
498 protected: | 500 protected: |
499 #if WEBKIT_USING_SKIA | 501 #if WEBKIT_USING_SKIA |
500 virtual GrGLInterface* onCreateGrGLInterface(); | 502 virtual GrGLInterface* onCreateGrGLInterface(); |
501 #endif | 503 #endif |
502 | 504 |
503 private: | 505 private: |
| 506 friend class WebGraphicsContext3DErrorMessageCallback; |
| 507 |
504 // Initialize the underlying GL context. May be called multiple times; second | 508 // Initialize the underlying GL context. May be called multiple times; second |
505 // and subsequent calls are ignored. Must be called from the thread that is | 509 // and subsequent calls are ignored. Must be called from the thread that is |
506 // going to use this object to issue GL commands (which might not be the main | 510 // going to use this object to issue GL commands (which might not be the main |
507 // thread). | 511 // thread). |
508 bool MaybeInitializeGL(); | 512 bool MaybeInitializeGL(); |
509 | 513 |
510 // SwapBuffers callback. | 514 // SwapBuffers callback. |
511 void OnSwapBuffersComplete(); | 515 void OnSwapBuffersComplete(); |
512 virtual void OnContextLost(ContentGLContext::ContextLostReason reason); | 516 virtual void OnContextLost(ContentGLContext::ContextLostReason reason); |
513 virtual void OnErrorMessage(const std::string& message, int id); | 517 virtual void OnErrorMessage(const std::string& message, int id); |
(...skipping 22 matching lines...) Expand all Loading... |
536 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client_; | 540 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client_; |
537 | 541 |
538 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* | 542 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* |
539 memory_allocation_changed_callback_; | 543 memory_allocation_changed_callback_; |
540 | 544 |
541 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 545 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
542 WGC3Denum context_lost_reason_; | 546 WGC3Denum context_lost_reason_; |
543 | 547 |
544 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* | 548 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* |
545 error_message_callback_; | 549 error_message_callback_; |
| 550 scoped_ptr<WebGraphicsContext3DErrorMessageCallback> |
| 551 client_error_message_callback_; |
546 | 552 |
547 WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* | 553 WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* |
548 swapbuffers_complete_callback_; | 554 swapbuffers_complete_callback_; |
549 | 555 |
550 WebKit::WebGraphicsContext3D::Attributes attributes_; | 556 WebKit::WebGraphicsContext3D::Attributes attributes_; |
551 gfx::GpuPreference gpu_preference_; | 557 gfx::GpuPreference gpu_preference_; |
552 int cached_width_, cached_height_; | 558 int cached_width_, cached_height_; |
553 | 559 |
554 // For tracking which FBO is bound. | 560 // For tracking which FBO is bound. |
555 WebGLId bound_fbo_; | 561 WebGLId bound_fbo_; |
556 | 562 |
557 // Errors raised by synthesizeGLError(). | 563 // Errors raised by synthesizeGLError(). |
558 std::vector<WGC3Denum> synthetic_errors_; | 564 std::vector<WGC3Denum> synthetic_errors_; |
559 | 565 |
560 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; | 566 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; |
561 | 567 |
562 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 568 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
563 std::vector<uint8> scanline_; | 569 std::vector<uint8> scanline_; |
564 void FlipVertically(uint8* framebuffer, | 570 void FlipVertically(uint8* framebuffer, |
565 unsigned int width, | 571 unsigned int width, |
566 unsigned int height); | 572 unsigned int height); |
567 #endif | 573 #endif |
568 }; | 574 }; |
569 | 575 |
570 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 576 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |