OLD | NEW |
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 #include "ui/gfx/surface/transport_dib.h" | 5 #include "ui/gfx/surface/transport_dib.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) { | 27 TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) { |
28 size_t allocation_granularity = base::SysInfo::VMAllocationGranularity(); | 28 size_t allocation_granularity = base::SysInfo::VMAllocationGranularity(); |
29 size = size / allocation_granularity + 1; | 29 size = size / allocation_granularity + 1; |
30 size = size * allocation_granularity; | 30 size = size * allocation_granularity; |
31 | 31 |
32 TransportDIB* dib = new TransportDIB; | 32 TransportDIB* dib = new TransportDIB; |
33 | 33 |
34 if (!dib->shared_memory_.CreateAnonymous(size)) { | 34 if (!dib->shared_memory_.CreateAnonymous(size, false)) { |
35 delete dib; | 35 delete dib; |
36 return NULL; | 36 return NULL; |
37 } | 37 } |
38 | 38 |
39 dib->size_ = size; | 39 dib->size_ = size; |
40 dib->sequence_num_ = sequence_num; | 40 dib->sequence_num_ = sequence_num; |
41 | 41 |
42 return dib; | 42 return dib; |
43 } | 43 } |
44 | 44 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return shared_memory_.memory(); | 101 return shared_memory_.memory(); |
102 } | 102 } |
103 | 103 |
104 TransportDIB::Handle TransportDIB::handle() const { | 104 TransportDIB::Handle TransportDIB::handle() const { |
105 return shared_memory_.handle(); | 105 return shared_memory_.handle(); |
106 } | 106 } |
107 | 107 |
108 TransportDIB::Id TransportDIB::id() const { | 108 TransportDIB::Id TransportDIB::id() const { |
109 return Id(handle(), sequence_num_); | 109 return Id(handle(), sequence_num_); |
110 } | 110 } |
OLD | NEW |