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

Side by Side Diff: ppapi/proxy/gamepad_resource.cc

Issue 2849633002: Get rid of base::SharedMemory::NULLHandle(); (Closed)
Patch Set: Rebase. 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 | « ppapi/nacl_irt/ppapi_dispatcher.cc ('k') | ppapi/proxy/media_stream_track_resource_base.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 "ppapi/proxy/gamepad_resource.h" 5 #include "ppapi/proxy/gamepad_resource.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // hardware thread is taking unusally long). 96 // hardware thread is taking unusally long).
97 if (contention_count < kMaximumContentionCount) 97 if (contention_count < kMaximumContentionCount)
98 ConvertWebKitGamepadData(read_into, &last_read_); 98 ConvertWebKitGamepadData(read_into, &last_read_);
99 99
100 memcpy(data, &last_read_, sizeof(PP_GamepadsSampleData)); 100 memcpy(data, &last_read_, sizeof(PP_GamepadsSampleData));
101 } 101 }
102 102
103 void GamepadResource::OnPluginMsgSendMemory( 103 void GamepadResource::OnPluginMsgSendMemory(
104 const ResourceMessageReplyParams& params) { 104 const ResourceMessageReplyParams& params) {
105 // On failure, the handle will be null and the CHECK below will be tripped. 105 // On failure, the handle will be null and the CHECK below will be tripped.
106 base::SharedMemoryHandle handle = base::SharedMemory::NULLHandle(); 106 base::SharedMemoryHandle handle;
107 params.TakeSharedMemoryHandleAtIndex(0, &handle); 107 params.TakeSharedMemoryHandleAtIndex(0, &handle);
108 108
109 shared_memory_.reset(new base::SharedMemory(handle, true)); 109 shared_memory_.reset(new base::SharedMemory(handle, true));
110 CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer))); 110 CHECK(shared_memory_->Map(sizeof(ContentGamepadHardwareBuffer)));
111 buffer_ = static_cast<const ContentGamepadHardwareBuffer*>( 111 buffer_ = static_cast<const ContentGamepadHardwareBuffer*>(
112 shared_memory_->memory()); 112 shared_memory_->memory());
113 } 113 }
114 114
115 } // namespace proxy 115 } // namespace proxy
116 } // namespace ppapi 116 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/nacl_irt/ppapi_dispatcher.cc ('k') | ppapi/proxy/media_stream_track_resource_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698