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

Side by Side Diff: app/surface/transport_dib_mac.cc

Issue 2835007: Revert 49984 - patch from issue 2762014 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/mach_ipc_mac.h » ('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 "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"
11 #include "base/logging.h"
12 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
13 #include "base/shared_memory.h" 12 #include "base/shared_memory.h"
14 #include "skia/ext/platform_canvas.h" 13 #include "skia/ext/platform_canvas.h"
15 14
16 TransportDIB::TransportDIB() 15 TransportDIB::TransportDIB()
17 : size_(0) { 16 : size_(0) {
18 } 17 }
19 18
20 TransportDIB::TransportDIB(TransportDIB::Handle dib) 19 TransportDIB::TransportDIB(TransportDIB::Handle dib)
21 : shared_memory_(dib, false /* read write */), 20 : shared_memory_(dib, false /* read write */),
(...skipping 19 matching lines...) Expand all
41 // static 40 // static
42 TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) { 41 TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) {
43 if (!is_valid(handle)) 42 if (!is_valid(handle))
44 return NULL; 43 return NULL;
45 44
46 TransportDIB* dib = new TransportDIB(handle); 45 TransportDIB* dib = new TransportDIB(handle);
47 struct stat st; 46 struct stat st;
48 if ((fstat(handle.fd, &st) != 0) || 47 if ((fstat(handle.fd, &st) != 0) ||
49 (!dib->shared_memory_.Map(st.st_size))) { 48 (!dib->shared_memory_.Map(st.st_size))) {
50 delete dib; 49 delete dib;
51 if (HANDLE_EINTR(close(handle.fd)) < 0) 50 HANDLE_EINTR(close(handle.fd));
52 PLOG(ERROR) << "close";
53 return NULL; 51 return NULL;
54 } 52 }
55 53
56 dib->size_ = st.st_size; 54 dib->size_ = st.st_size;
57 55
58 return dib; 56 return dib;
59 } 57 }
60 58
61 bool TransportDIB::is_valid(Handle dib) { 59 bool TransportDIB::is_valid(Handle dib) {
62 return dib.fd >= 0; 60 return dib.fd >= 0;
(...skipping 10 matching lines...) Expand all
73 return shared_memory_.memory(); 71 return shared_memory_.memory();
74 } 72 }
75 73
76 TransportDIB::Id TransportDIB::id() const { 74 TransportDIB::Id TransportDIB::id() const {
77 return shared_memory_.id(); 75 return shared_memory_.id();
78 } 76 }
79 77
80 TransportDIB::Handle TransportDIB::handle() const { 78 TransportDIB::Handle TransportDIB::handle() const {
81 return shared_memory_.handle(); 79 return shared_memory_.handle();
82 } 80 }
OLDNEW
« no previous file with comments | « no previous file | base/mach_ipc_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698