OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <sys/ipc.h> | 7 #include <sys/ipc.h> |
8 #include <sys/shm.h> | 8 #include <sys/shm.h> |
9 | 9 |
10 #include "app/surface/transport_dib.h" | 10 #include "app/surface/transport_dib.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 // static | 76 // static |
77 TransportDIB* TransportDIB::CreateWithHandle(Handle shmkey) { | 77 TransportDIB* TransportDIB::CreateWithHandle(Handle shmkey) { |
78 TransportDIB* dib = new TransportDIB; | 78 TransportDIB* dib = new TransportDIB; |
79 dib->key_ = shmkey; | 79 dib->key_ = shmkey; |
80 return dib; | 80 return dib; |
81 } | 81 } |
82 | 82 |
83 // static | 83 // static |
| 84 TransportDIB::Id TransportDIB::InvalidId() { |
| 85 return -1; |
| 86 } |
| 87 |
| 88 // static |
84 bool TransportDIB::is_valid(Handle dib) { | 89 bool TransportDIB::is_valid(Handle dib) { |
85 return dib >= 0; | 90 return dib >= 0; |
86 } | 91 } |
87 | 92 |
88 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { | 93 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { |
89 if (address_ == kInvalidAddress && !Map()) | 94 if (address_ == kInvalidAddress && !Map()) |
90 return NULL; | 95 return NULL; |
91 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); | 96 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); |
92 if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory()))) | 97 if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory()))) |
93 return NULL; | 98 return NULL; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 132 } |
128 | 133 |
129 XID TransportDIB::MapToX(Display* display) { | 134 XID TransportDIB::MapToX(Display* display) { |
130 if (!x_shm_) { | 135 if (!x_shm_) { |
131 x_shm_ = ui::AttachSharedMemory(display, key_); | 136 x_shm_ = ui::AttachSharedMemory(display, key_); |
132 display_ = display; | 137 display_ = display; |
133 } | 138 } |
134 | 139 |
135 return x_shm_; | 140 return x_shm_; |
136 } | 141 } |
OLD | NEW |