| 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 "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 dib->address_ = address; | 62 dib->address_ = address; |
| 63 dib->size_ = size; | 63 dib->size_ = size; |
| 64 return dib; | 64 return dib; |
| 65 } | 65 } |
| 66 | 66 |
| 67 TransportDIB* TransportDIB::Map(Handle shmkey) { | 67 TransportDIB* TransportDIB::Map(Handle shmkey) { |
| 68 struct shmid_ds shmst; | 68 struct shmid_ds shmst; |
| 69 if (shmctl(shmkey, IPC_STAT, &shmst) == -1) | 69 if (shmctl(shmkey, IPC_STAT, &shmst) == -1) |
| 70 return NULL; | 70 return NULL; |
| 71 | 71 |
| 72 void* address = shmat(shmkey, NULL /* desired address */, SHM_RDONLY); | 72 void* address = shmat(shmkey, NULL /* desired address */, 0 /* flags */); |
| 73 if (address == kInvalidAddress) | 73 if (address == kInvalidAddress) |
| 74 return NULL; | 74 return NULL; |
| 75 | 75 |
| 76 TransportDIB* dib = new TransportDIB; | 76 TransportDIB* dib = new TransportDIB; |
| 77 | 77 |
| 78 dib->address_ = address; | 78 dib->address_ = address; |
| 79 dib->size_ = shmst.shm_segsz; | 79 dib->size_ = shmst.shm_segsz; |
| 80 dib->key_ = shmkey; | 80 dib->key_ = shmkey; |
| 81 return dib; | 81 return dib; |
| 82 } | 82 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 XID TransportDIB::MapToX(Display* display) { | 102 XID TransportDIB::MapToX(Display* display) { |
| 103 if (!x_shm_) { | 103 if (!x_shm_) { |
| 104 x_shm_ = x11_util::AttachSharedMemory(display, key_); | 104 x_shm_ = x11_util::AttachSharedMemory(display, key_); |
| 105 display_ = display; | 105 display_ = display; |
| 106 } | 106 } |
| 107 | 107 |
| 108 return x_shm_; | 108 return x_shm_; |
| 109 } | 109 } |
| OLD | NEW |