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

Side by Side Diff: device/gamepad/gamepad_provider.cc

Issue 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Compile error. 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 | « device/gamepad/gamepad_provider.h ('k') | device/gamepad/gamepad_provider_unittest.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) 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 "device/gamepad/gamepad_provider.h" 5 #include "device/gamepad/gamepad_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 FROM_HERE, base::Bind(&GamepadFetcherVector::clear, 75 FROM_HERE, base::Bind(&GamepadFetcherVector::clear,
76 base::Unretained(&data_fetchers_))); 76 base::Unretained(&data_fetchers_)));
77 77
78 // Use Stop() to join the polling thread, as there may be pending callbacks 78 // Use Stop() to join the polling thread, as there may be pending callbacks
79 // which dereference |polling_thread_|. 79 // which dereference |polling_thread_|.
80 polling_thread_->Stop(); 80 polling_thread_->Stop();
81 81
82 DCHECK(data_fetchers_.empty()); 82 DCHECK(data_fetchers_.empty());
83 } 83 }
84 84
85 base::SharedMemoryHandle GamepadProvider::GetSharedMemoryHandleForProcess( 85 base::SharedMemoryHandle GamepadProvider::DuplicateSharedMemoryHandle() {
86 base::ProcessHandle process) { 86 return gamepad_shared_buffer_->shared_memory()->handle().Duplicate();
87 base::SharedMemoryHandle renderer_handle;
88 gamepad_shared_buffer_->shared_memory()->ShareToProcess(process,
89 &renderer_handle);
90 return renderer_handle;
91 } 87 }
92 88
93 mojo::ScopedSharedBufferHandle GamepadProvider::GetSharedBufferHandle() { 89 mojo::ScopedSharedBufferHandle GamepadProvider::GetSharedBufferHandle() {
94 // TODO(heke): Use mojo::SharedBuffer rather than base::SharedMemory in 90 // TODO(heke): Use mojo::SharedBuffer rather than base::SharedMemory in
95 // GamepadSharedBuffer. See crbug.com/670655 for details 91 // GamepadSharedBuffer. See crbug.com/670655 for details
96 base::SharedMemoryHandle handle = base::SharedMemory::DuplicateHandle( 92 base::SharedMemoryHandle handle = base::SharedMemory::DuplicateHandle(
97 gamepad_shared_buffer_->shared_memory()->handle()); 93 gamepad_shared_buffer_->shared_memory()->handle());
98 return mojo::WrapSharedMemoryHandle(handle, sizeof(GamepadHardwareBuffer), 94 return mojo::WrapSharedMemoryHandle(handle, sizeof(GamepadHardwareBuffer),
99 true /* read_only */); 95 true /* read_only */);
100 } 96 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ever_had_user_gesture_ = true; 320 ever_had_user_gesture_ = true;
325 for (size_t i = 0; i < user_gesture_observers_.size(); i++) { 321 for (size_t i = 0; i < user_gesture_observers_.size(); i++) {
326 user_gesture_observers_[i].task_runner->PostTask( 322 user_gesture_observers_[i].task_runner->PostTask(
327 FROM_HERE, user_gesture_observers_[i].closure); 323 FROM_HERE, user_gesture_observers_[i].closure);
328 } 324 }
329 user_gesture_observers_.clear(); 325 user_gesture_observers_.clear();
330 } 326 }
331 } 327 }
332 328
333 } // namespace device 329 } // namespace device
OLDNEW
« no previous file with comments | « device/gamepad/gamepad_provider.h ('k') | device/gamepad/gamepad_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698