OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/surface/transport_dib.h" | 5 #include "ui/surface/transport_dib.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
8 | 10 |
9 #include <limits> | 11 #include <limits> |
10 | 12 |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
14 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
15 | 17 |
16 TransportDIB::TransportDIB() | 18 TransportDIB::TransportDIB() |
17 : size_(0) { | 19 : size_(0) { |
18 } | 20 } |
19 | 21 |
20 TransportDIB::~TransportDIB() { | 22 TransportDIB::~TransportDIB() { |
21 } | 23 } |
22 | 24 |
23 TransportDIB::TransportDIB(base::SharedMemoryHandle handle) | 25 TransportDIB::TransportDIB(base::SharedMemoryHandle handle) |
24 : shared_memory_(handle, false /* read write */), size_(0) {} | 26 : shared_memory_(handle, false /* read write */), size_(0) {} |
25 | 27 |
26 // static | 28 // static |
27 TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) { | 29 TransportDIB* TransportDIB::Create(size_t size, uint32_t sequence_num) { |
28 TransportDIB* dib = new TransportDIB; | 30 TransportDIB* dib = new TransportDIB; |
29 | 31 |
30 if (!dib->shared_memory_.CreateAnonymous(size)) { | 32 if (!dib->shared_memory_.CreateAnonymous(size)) { |
31 delete dib; | 33 delete dib; |
32 return NULL; | 34 return NULL; |
33 } | 35 } |
34 | 36 |
35 dib->size_ = size; | 37 dib->size_ = size; |
36 dib->sequence_num_ = sequence_num; | 38 dib->sequence_num_ = sequence_num; |
37 | 39 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return false; | 91 return false; |
90 } | 92 } |
91 | 93 |
92 size_ = shared_memory_.mapped_size(); | 94 size_ = shared_memory_.mapped_size(); |
93 return true; | 95 return true; |
94 } | 96 } |
95 | 97 |
96 void* TransportDIB::memory() const { | 98 void* TransportDIB::memory() const { |
97 return shared_memory_.memory(); | 99 return shared_memory_.memory(); |
98 } | 100 } |
OLD | NEW |