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> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <limits> | 11 #include <limits> |
| 12 #include <memory> |
12 | 13 |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
16 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
17 | 17 |
18 TransportDIB::TransportDIB() | 18 TransportDIB::TransportDIB() |
19 : size_(0) { | 19 : size_(0) { |
20 } | 20 } |
21 | 21 |
22 TransportDIB::~TransportDIB() { | 22 TransportDIB::~TransportDIB() { |
23 } | 23 } |
24 | 24 |
(...skipping 10 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 dib->size_ = size; | 37 dib->size_ = size; |
38 dib->sequence_num_ = sequence_num; | 38 dib->sequence_num_ = sequence_num; |
39 | 39 |
40 return dib; | 40 return dib; |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 TransportDIB* TransportDIB::Map(Handle handle) { | 44 TransportDIB* TransportDIB::Map(Handle handle) { |
45 scoped_ptr<TransportDIB> dib(CreateWithHandle(handle)); | 45 std::unique_ptr<TransportDIB> dib(CreateWithHandle(handle)); |
46 if (!dib->Map()) | 46 if (!dib->Map()) |
47 return NULL; | 47 return NULL; |
48 return dib.release(); | 48 return dib.release(); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
52 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { | 52 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { |
53 return new TransportDIB(handle); | 53 return new TransportDIB(handle); |
54 } | 54 } |
55 | 55 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 return false; | 91 return false; |
92 } | 92 } |
93 | 93 |
94 size_ = shared_memory_.mapped_size(); | 94 size_ = shared_memory_.mapped_size(); |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 void* TransportDIB::memory() const { | 98 void* TransportDIB::memory() const { |
99 return shared_memory_.memory(); | 99 return shared_memory_.memory(); |
100 } | 100 } |
OLD | NEW |