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

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

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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
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/resource_message_params.h" 5 #include "ppapi/proxy/resource_message_params.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/proxy/ppapi_messages.h" 9 #include "ppapi/proxy/ppapi_messages.h"
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 size_t index, 84 size_t index,
85 IPC::PlatformFileForTransit* handle) const { 85 IPC::PlatformFileForTransit* handle) const {
86 SerializedHandle serialized = TakeHandleOfTypeAtIndex( 86 SerializedHandle serialized = TakeHandleOfTypeAtIndex(
87 index, SerializedHandle::SOCKET); 87 index, SerializedHandle::SOCKET);
88 if (!serialized.is_socket()) 88 if (!serialized.is_socket())
89 return false; 89 return false;
90 *handle = serialized.descriptor(); 90 *handle = serialized.descriptor();
91 return true; 91 return true;
92 } 92 }
93 93
94 bool ResourceMessageParams::TakeFileHandleAtIndex(
95 size_t index,
96 IPC::PlatformFileForTransit* handle) const {
97 SerializedHandle serialized = TakeHandleOfTypeAtIndex(
98 index, SerializedHandle::FILE);
99 if (!serialized.is_file())
100 return false;
101 *handle = serialized.descriptor();
102 return true;
103 }
104
94 void ResourceMessageParams::TakeAllSharedMemoryHandles( 105 void ResourceMessageParams::TakeAllSharedMemoryHandles(
95 std::vector<base::SharedMemoryHandle>* handles) const { 106 std::vector<base::SharedMemoryHandle>* handles) const {
96 for (size_t i = 0; i < handles_->data().size(); ++i) { 107 for (size_t i = 0; i < handles_->data().size(); ++i) {
97 base::SharedMemoryHandle handle; 108 base::SharedMemoryHandle handle;
98 if (TakeSharedMemoryHandleAtIndex(i, &handle)) 109 if (TakeSharedMemoryHandleAtIndex(i, &handle))
99 handles->push_back(handle); 110 handles->push_back(handle);
100 } 111 }
101 } 112 }
102 113
103 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const { 114 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 162
152 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg, 163 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg,
153 PickleIterator* iter) { 164 PickleIterator* iter) {
154 if (!ResourceMessageParams::Deserialize(msg, iter)) 165 if (!ResourceMessageParams::Deserialize(msg, iter))
155 return false; 166 return false;
156 return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_); 167 return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_);
157 } 168 }
158 169
159 } // namespace proxy 170 } // namespace proxy
160 } // namespace ppapi 171 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698