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

Side by Side Diff: ui/gfx/compositor/compositor_cc.h

Issue 8307001: Enable accelerated compositing of web pages when using webkit compositor (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years, 1 month 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
« no previous file with comments | « ui/gfx/compositor/compositor.h ('k') | ui/gfx/compositor/compositor_cc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ 5 #ifndef UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_
6 #define UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/singleton.h"
11 #include "base/memory/ref_counted.h"
10 #include "ui/gfx/compositor/compositor.h" 12 #include "ui/gfx/compositor/compositor.h"
11 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayer.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayer.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerTreeView.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerTreeView.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerTreeViewClien t.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerTreeViewClien t.h"
16 18
17 namespace gfx { 19 namespace gfx {
18 class Rect; 20 class Rect;
21 class GLContext;
22 class GLSurface;
23 class GLShareGroup;
19 } 24 }
20 25
21 namespace ui { 26 namespace ui {
22 27
28 class COMPOSITOR_EXPORT SharedResourcesCC : public SharedResources {
29 public:
30 static SharedResourcesCC* GetInstance();
31
32 virtual bool MakeSharedContextCurrent();
33 gfx::GLShareGroup* GetShareGroup();
34
35 private:
36 friend struct DefaultSingletonTraits<SharedResourcesCC>;
37
38 SharedResourcesCC();
39 virtual ~SharedResourcesCC();
40
41 bool Initialize();
42 void Destroy();
43
44 bool initialized_;
45
46 scoped_refptr<gfx::GLContext> context_;
47 scoped_refptr<gfx::GLSurface> surface_;
48
49 DISALLOW_COPY_AND_ASSIGN(SharedResourcesCC);
50 };
51
23 class COMPOSITOR_EXPORT TextureCC : public Texture { 52 class COMPOSITOR_EXPORT TextureCC : public Texture {
24 public: 53 public:
25 TextureCC(); 54 TextureCC();
26 55
27 // Texture implementation. 56 // Texture implementation.
28 virtual void SetCanvas(const SkCanvas& canvas, 57 virtual void SetCanvas(const SkCanvas& canvas,
29 const gfx::Point& origin, 58 const gfx::Point& origin,
30 const gfx::Size& overall_size) OVERRIDE; 59 const gfx::Size& overall_size) OVERRIDE;
31 60
32 virtual void Draw(const ui::TextureDrawParams& params, 61 virtual void Draw(const ui::TextureDrawParams& params,
33 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; 62 const gfx::Rect& clip_bounds_in_texture) OVERRIDE;
34 63
35 private: 64 virtual void Update() = 0;
65 unsigned int texture_id() const { return texture_id_; }
66 bool flipped() const { return flipped_; }
67
68 protected:
69 unsigned int texture_id_;
70 bool flipped_;
36 DISALLOW_COPY_AND_ASSIGN(TextureCC); 71 DISALLOW_COPY_AND_ASSIGN(TextureCC);
37 }; 72 };
38 73
39 class COMPOSITOR_EXPORT CompositorCC : public Compositor, 74 class COMPOSITOR_EXPORT CompositorCC : public Compositor,
40 public WebKit::WebLayerTreeViewClient, 75 public WebKit::WebLayerTreeViewClient,
41 public WebKit::WebLayerClient { 76 public WebKit::WebLayerClient {
42 public: 77 public:
43 CompositorCC(CompositorDelegate* delegate, 78 CompositorCC(CompositorDelegate* delegate,
44 gfx::AcceleratedWidget widget, 79 gfx::AcceleratedWidget widget,
45 const gfx::Size& size); 80 const gfx::Size& size);
(...skipping 27 matching lines...) Expand all
73 gfx::AcceleratedWidget widget_; 108 gfx::AcceleratedWidget widget_;
74 WebKit::WebLayer root_web_layer_; 109 WebKit::WebLayer root_web_layer_;
75 WebKit::WebLayerTreeView host_; 110 WebKit::WebLayerTreeView host_;
76 111
77 DISALLOW_COPY_AND_ASSIGN(CompositorCC); 112 DISALLOW_COPY_AND_ASSIGN(CompositorCC);
78 }; 113 };
79 114
80 } // namespace ui 115 } // namespace ui
81 116
82 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ 117 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor.h ('k') | ui/gfx/compositor/compositor_cc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698