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

Side by Side Diff: content/renderer/pepper/ppb_buffer_impl.cc

Issue 1154613006: Update pepper to not assume that SharedMemoryHandle is an int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove changes to base/memory. Created 5 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
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 "content/renderer/pepper/ppb_buffer_impl.h" 5 #include "content/renderer/pepper/ppb_buffer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (map_count_++ == 0) 71 if (map_count_++ == 0)
72 shared_memory_->Map(size_); 72 shared_memory_->Map(size_);
73 return shared_memory_->memory(); 73 return shared_memory_->memory();
74 } 74 }
75 75
76 void PPB_Buffer_Impl::Unmap() { 76 void PPB_Buffer_Impl::Unmap() {
77 if (--map_count_ == 0) 77 if (--map_count_ == 0)
78 shared_memory_->Unmap(); 78 shared_memory_->Unmap();
79 } 79 }
80 80
81 int32_t PPB_Buffer_Impl::GetSharedMemory(int* shm_handle) { 81 int32_t PPB_Buffer_Impl::GetSharedMemory(base::SharedMemoryHandle* shm_handle) {
82 *shm_handle = reinterpret_cast<int>(PlatformFileFromSharedMemoryHandle( 82 *shm_handle = base::SharedMemory::ShallowCopyHandle(shared_memory_->handle());
piman 2015/06/01 22:16:08 Same here, do we need ShallowCopy, or can we just
erikchen 2015/06/01 23:48:53 Changed the interface to pass a base::SharedMemory
83 shared_memory_->handle()));
84 return PP_OK; 83 return PP_OK;
85 } 84 }
86 85
87 BufferAutoMapper::BufferAutoMapper(PPB_Buffer_API* api) : api_(api) { 86 BufferAutoMapper::BufferAutoMapper(PPB_Buffer_API* api) : api_(api) {
88 needs_unmap_ = !PP_ToBool(api->IsMapped()); 87 needs_unmap_ = !PP_ToBool(api->IsMapped());
89 data_ = api->Map(); 88 data_ = api->Map();
90 api->Describe(&size_); 89 api->Describe(&size_);
91 } 90 }
92 91
93 BufferAutoMapper::~BufferAutoMapper() { 92 BufferAutoMapper::~BufferAutoMapper() {
94 if (needs_unmap_) 93 if (needs_unmap_)
95 api_->Unmap(); 94 api_->Unmap();
96 } 95 }
97 96
98 } // namespace content 97 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698