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

Side by Side Diff: ui/compositor/offscreen_context.h

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add cc::GaneshResourceProvider Created 7 years, 10 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_COMPOSITOR_OFFSCREEN_CONTEXT_H_
6 #define UI_COMPOSITOR_OFFSCREEN_CONTEXT_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "skia/ext/refptr.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
11 #include "ui/compositor/compositor_export.h"
12
13 class GrContext;
14
15 namespace ui {
16 class ContextFactory;
17 class OffscreenContext;
18
19 class COMPOSITOR_EXPORT OffscreenContextClient {
20 public:
21 virtual void DidLoseContext(OffscreenContext* offscreen_context) = 0;
22 virtual void DidCreateContext(OffscreenContext* offscreen_context,
23 bool success) = 0;
24 };
25
26 // This class lazily creates an offscreen context and a GrContext that is
27 // bounds to the offscreen context.
28 class COMPOSITOR_EXPORT OffscreenContext
29 : public NON_EXPORTED_BASE(
30 WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) {
31 public:
32 OffscreenContext(
33 ui::ContextFactory* context_factory,
34 OffscreenContextClient* client);
35 virtual ~OffscreenContext();
36
37 WebKit::WebGraphicsContext3D* Context3d();
38 class GrContext* GrContext();
39
40 protected:
41 // The limit of the number of textures we hold in the GrContext's
42 // bitmap->texture cache.
43 static const int kMaxGaneshTextureCacheCount = 2048;
44 // The limit of the bytes allocated toward textures in the GrContext's
45 // bitmap->texture cache.
46 static const size_t kMaxGaneshTextureCacheBytes = 96 * 1024 * 1024;
47
48 WebKit::WebGraphicsContext3D* context3d_if_exists() const {
49 return context3d_.get();
50 }
51 class GrContext* gr_context_if_exists() const { return gr_context_.get(); }
52
53 virtual void DidCreateContext(bool success);
54
55 private:
56 // WebGraphicsContextLostCallback implementation.
57 virtual void onContextLost() OVERRIDE;
58
59 ui::ContextFactory* context_factory_;
60 OffscreenContextClient* client_;
61 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
62 skia::RefPtr<class GrContext> gr_context_;
63 };
64
65 } // namespace ui
66
67 #endif // UI_COMPOSITOR_OFFSCREEN_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698