Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/common/transport_dib_mac.cc

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)
Patch Set: ... Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/process_watcher_posix.cc ('k') | net/base/file_stream_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/common/transport_dib.h" 5 #include "chrome/common/transport_dib.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9
10 #include "base/eintr_wrappers.h"
9 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
10 12
11 TransportDIB::TransportDIB() 13 TransportDIB::TransportDIB()
12 : size_(0) { 14 : size_(0) {
13 } 15 }
14 16
15 TransportDIB::TransportDIB(TransportDIB::Handle dib) 17 TransportDIB::TransportDIB(TransportDIB::Handle dib)
16 : shared_memory_(dib, false /* read write */), 18 : shared_memory_(dib, false /* read write */),
17 size_(0) { 19 size_(0) {
18 } 20 }
(...skipping 15 matching lines...) Expand all
34 } 36 }
35 37
36 // static 38 // static
37 TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) { 39 TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) {
38 TransportDIB* dib = new TransportDIB(handle); 40 TransportDIB* dib = new TransportDIB(handle);
39 struct stat st; 41 struct stat st;
40 fstat(handle.fd, &st); 42 fstat(handle.fd, &st);
41 43
42 if (!dib->shared_memory_.Map(st.st_size)) { 44 if (!dib->shared_memory_.Map(st.st_size)) {
43 delete dib; 45 delete dib;
44 close(handle.fd); 46 HANDLE_EINTR(close(handle.fd));
45 return false; 47 return false;
46 } 48 }
47 49
48 dib->size_ = st.st_size; 50 dib->size_ = st.st_size;
49 51
50 return dib; 52 return dib;
51 } 53 }
52 54
53 void* TransportDIB::memory() const { 55 void* TransportDIB::memory() const {
54 return shared_memory_.memory(); 56 return shared_memory_.memory();
55 } 57 }
56 58
57 TransportDIB::Id TransportDIB::id() const { 59 TransportDIB::Id TransportDIB::id() const {
58 return shared_memory_.id(); 60 return shared_memory_.id();
59 } 61 }
60 62
61 TransportDIB::Handle TransportDIB::handle() const { 63 TransportDIB::Handle TransportDIB::handle() const {
62 return shared_memory_.handle(); 64 return shared_memory_.handle();
63 } 65 }
OLDNEW
« no previous file with comments | « chrome/common/process_watcher_posix.cc ('k') | net/base/file_stream_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698