| 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 "app/surface/transport_dib.h" | 5 #include "app/surface/transport_dib.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include "base/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // static | 28 // static |
| 29 TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) { | 29 TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) { |
| 30 TransportDIB* dib = new TransportDIB; | 30 TransportDIB* dib = new TransportDIB; |
| 31 if (!dib->shared_memory_.Create(L"", false /* read write */, | 31 if (!dib->shared_memory_.Create(L"", false /* read write */, |
| 32 false /* do not open existing */, size)) { | 32 false /* do not open existing */, size)) { |
| 33 delete dib; | 33 delete dib; |
| 34 return NULL; | 34 return NULL; |
| 35 } | 35 } |
| 36 | 36 |
| 37 if (!dib->shared_memory_.Map(size)) { |
| 38 delete dib; |
| 39 return NULL; |
| 40 } |
| 41 |
| 37 dib->size_ = size; | 42 dib->size_ = size; |
| 38 return dib; | 43 return dib; |
| 39 } | 44 } |
| 40 | 45 |
| 41 // static | 46 // static |
| 42 TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) { | 47 TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) { |
| 43 if (!is_valid(handle)) | 48 if (!is_valid(handle)) |
| 44 return NULL; | 49 return NULL; |
| 45 | 50 |
| 46 TransportDIB* dib = new TransportDIB(handle); | 51 TransportDIB* dib = new TransportDIB(handle); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 73 return shared_memory_.memory(); | 78 return shared_memory_.memory(); |
| 74 } | 79 } |
| 75 | 80 |
| 76 TransportDIB::Id TransportDIB::id() const { | 81 TransportDIB::Id TransportDIB::id() const { |
| 77 return shared_memory_.id(); | 82 return shared_memory_.id(); |
| 78 } | 83 } |
| 79 | 84 |
| 80 TransportDIB::Handle TransportDIB::handle() const { | 85 TransportDIB::Handle TransportDIB::handle() const { |
| 81 return shared_memory_.handle(); | 86 return shared_memory_.handle(); |
| 82 } | 87 } |
| OLD | NEW |