OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 "cc/proto/gpu_conversions.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "cc/proto/memory_allocation.pb.h" | |
9 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | |
10 | |
11 namespace cc { | |
12 | |
13 proto::MemoryAllocation::PriorityCutoff MemoryAllocationPriorityCutoffToProto( | |
14 const gpu::MemoryAllocation::PriorityCutoff& priority_cutoff) { | |
15 switch (priority_cutoff) { | |
16 case gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_NOTHING: | |
17 return proto::MemoryAllocation_PriorityCutoff_ALLOW_NOTHING; | |
18 case gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_REQUIRED_ONLY: | |
19 return proto::MemoryAllocation_PriorityCutoff_ALLOW_REQUIRED_ONLY; | |
20 case gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_NICE_TO_HAVE: | |
21 return proto::MemoryAllocation_PriorityCutoff_ALLOW_NICE_TO_HAVE; | |
22 case gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_EVERYTHING: | |
23 return proto::MemoryAllocation_PriorityCutoff_ALLOW_EVERYTHING; | |
24 } | |
25 return proto::MemoryAllocation_PriorityCutoff_UNKNOWN; | |
26 } | |
27 | |
28 gpu::MemoryAllocation::PriorityCutoff MemoryAllocationPriorityCutoffFromProto( | |
29 const proto::MemoryAllocation::PriorityCutoff& priority_cutoff) { | |
30 switch (priority_cutoff) { | |
31 case proto::MemoryAllocation_PriorityCutoff_ALLOW_NOTHING: | |
32 return gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_NOTHING; | |
33 case proto::MemoryAllocation_PriorityCutoff_ALLOW_REQUIRED_ONLY: | |
34 return gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_REQUIRED_ONLY; | |
35 case proto::MemoryAllocation_PriorityCutoff_ALLOW_NICE_TO_HAVE: | |
36 return gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_NICE_TO_HAVE; | |
37 case proto::MemoryAllocation_PriorityCutoff_ALLOW_EVERYTHING: | |
38 return gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_EVERYTHING; | |
39 case proto::MemoryAllocation_PriorityCutoff_UNKNOWN: | |
40 NOTREACHED() << "Received MemoryAllocation::PriorityCutoff_UNKNOWN"; | |
41 return gpu::MemoryAllocation::PriorityCutoff::CUTOFF_LAST; | |
42 } | |
43 return gpu::MemoryAllocation::PriorityCutoff::CUTOFF_ALLOW_NOTHING; | |
44 } | |
45 | |
46 } // namespace cc | |
OLD | NEW |