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

Side by Side Diff: content/common/gpu/client/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: Back to a single OffscreenContext class 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 CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_H_
6 #define CONTENT_COMMON_GPU_CLIENT_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
12 class GrContext;
13
14 namespace content {
15 class OffscreenContext;
16
17 class OffscreenContextClient {
18 public:
19 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0;
20
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 GrContext that is bound to an
27 // offscreen context lazily created by its subclass implementation.
28 class OffscreenContext
29 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback,
30 public WebKit::WebGraphicsContext3D::
31 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM {
32 public:
33 explicit OffscreenContext(OffscreenContextClient* client);
34 virtual ~OffscreenContext();
35
36 WebKit::WebGraphicsContext3D* Context3d();
piman 2013/02/11 18:45:33 nit: Context3D for consistency?
danakj 2013/02/11 18:58:13 Hm, I've been using Context3d for function names a
37 class GrContext* GrContext();
38
39 protected:
40 void SetGaneshContextMemoryLimit(bool nonzero_allocation);
41
42 private:
43 // WebGraphicsContextLostCallback implementation.
44 virtual void onContextLost() OVERRIDE;
45 // WebGraphicsMemoryAllocationChangedCallbackCHROMIUM implementation.
46 virtual void onMemoryAllocationChanged(
47 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE;
48
49 // The limit of the number of textures we hold in the GrContext's
50 // bitmap->texture cache.
51 static const int kMaxGaneshTextureCacheCount = 2048;
52 // The limit of the bytes allocated toward textures in the GrContext's
53 // bitmap->texture cache.
54 static const size_t kMaxGaneshTextureCacheBytes = 96 * 1024 * 1024;
55
56 OffscreenContextClient* client_;
57 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
58 skia::RefPtr<class GrContext> gr_context_;
59 };
60
61 } // namespace content
62
63 #endif // CONTENT_COMMON_GPU_CLIENT_OFFSCREEN_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698