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

Side by Side Diff: ui/surface/transport_dib_posix.cc

Issue 2875453002: Add a size parameter to SharedMemoryHandle. (Closed)
Patch Set: Remove extraneous period. Created 3 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 | « ui/gfx/mojo/buffer_types_struct_traits.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/surface/transport_dib.h" 5 #include "ui/surface/transport_dib.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (!is_valid_handle(shared_memory_.handle())) 72 if (!is_valid_handle(shared_memory_.handle()))
73 return false; 73 return false;
74 #if defined(OS_ANDROID) 74 #if defined(OS_ANDROID)
75 if (!shared_memory_.Map(0)) 75 if (!shared_memory_.Map(0))
76 return false; 76 return false;
77 size_ = shared_memory_.mapped_size(); 77 size_ = shared_memory_.mapped_size();
78 #else 78 #else
79 if (memory()) 79 if (memory())
80 return true; 80 return true;
81 81
82 size_t size; 82 size_t size = shared_memory_.handle().GetSize();
83 bool success = base::SharedMemory::GetSizeFromSharedMemoryHandle( 83 if (!shared_memory_.Map(size))
84 shared_memory_.handle(), &size);
85 if (!success || !shared_memory_.Map(size))
86 return false; 84 return false;
87 85
88 size_ = size; 86 size_ = size;
89 #endif 87 #endif
90 return true; 88 return true;
91 } 89 }
92 90
93 void* TransportDIB::memory() const { 91 void* TransportDIB::memory() const {
94 return shared_memory_.memory(); 92 return shared_memory_.memory();
95 } 93 }
OLDNEW
« no previous file with comments | « ui/gfx/mojo/buffer_types_struct_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698