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

Side by Side Diff: webkit/common/gpu/managed_memory_policy_convert.cc

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 years, 4 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
« no previous file with comments | « webkit/common/gpu/managed_memory_policy_convert.h ('k') | webkit/common/gpu/webkit_gpu.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webkit/common/gpu/managed_memory_policy_convert.h"
6
7 namespace webkit {
8 namespace gpu {
9
10 static cc::ManagedMemoryPolicy::PriorityCutoff ConvertPriorityCutoff(
11 WebKit::WebGraphicsMemoryAllocation::PriorityCutoff priority_cutoff) {
12 // This is simple a 1:1 map, the names differ only because the WebKit names
13 // should be to match the cc names.
14 switch (priority_cutoff) {
15 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowNothing:
16 return cc::ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING;
17 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowVisibleOnly:
18 return cc::ManagedMemoryPolicy::CUTOFF_ALLOW_REQUIRED_ONLY;
19 case WebKit::WebGraphicsMemoryAllocation::
20 PriorityCutoffAllowVisibleAndNearby:
21 return cc::ManagedMemoryPolicy::CUTOFF_ALLOW_NICE_TO_HAVE;
22 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowEverything:
23 return cc::ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING;
24 }
25 NOTREACHED();
26 return cc::ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING;
27 }
28
29 // static
30 cc::ManagedMemoryPolicy ManagedMemoryPolicyConvert::Convert(
31 const WebKit::WebGraphicsMemoryAllocation& allocation,
32 bool* discard_backbuffer_when_not_visible) {
33 *discard_backbuffer_when_not_visible = !allocation.suggestHaveBackbuffer;
34 return cc::ManagedMemoryPolicy(
35 allocation.bytesLimitWhenVisible,
36 ConvertPriorityCutoff(allocation.priorityCutoffWhenVisible),
37 allocation.bytesLimitWhenNotVisible,
38 ConvertPriorityCutoff(allocation.priorityCutoffWhenNotVisible),
39 cc::ManagedMemoryPolicy::kDefaultNumResourcesLimit);
40 }
41
42 } // namespace gpu
43 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/common/gpu/managed_memory_policy_convert.h ('k') | webkit/common/gpu/webkit_gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698