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

Side by Side Diff: ppapi/proxy/plugin_resource.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/plugin_resource.h" 5 #include "ppapi/proxy/plugin_resource.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ppapi/proxy/ppapi_messages.h" 9 #include "ppapi/proxy/ppapi_messages.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 bool PluginResource::SendResourceCall( 89 bool PluginResource::SendResourceCall(
90 Destination dest, 90 Destination dest,
91 const ResourceMessageCallParams& call_params, 91 const ResourceMessageCallParams& call_params,
92 const IPC::Message& nested_msg) { 92 const IPC::Message& nested_msg) {
93 return GetSender(dest)->Send( 93 return GetSender(dest)->Send(
94 new PpapiHostMsg_ResourceCall(call_params, nested_msg)); 94 new PpapiHostMsg_ResourceCall(call_params, nested_msg));
95 } 95 }
96 96
97 int32_t PluginResource::GenericSyncCall(Destination dest, 97 int32_t PluginResource::GenericSyncCall(
98 const IPC::Message& msg, 98 Destination dest,
99 IPC::Message* reply) { 99 const IPC::Message& msg,
100 IPC::Message* reply,
101 ResourceMessageReplyParams* reply_params) {
100 ResourceMessageCallParams params(pp_resource(), GetNextSequence()); 102 ResourceMessageCallParams params(pp_resource(), GetNextSequence());
101 params.set_has_callback(); 103 params.set_has_callback();
102 ResourceMessageReplyParams reply_params;
103 bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall( 104 bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall(
104 params, msg, &reply_params, reply)); 105 params, msg, reply_params, reply));
105 if (success) 106 if (success)
106 return reply_params.result(); 107 return reply_params->result();
107 return PP_ERROR_FAILED; 108 return PP_ERROR_FAILED;
108 } 109 }
109 110
110 int32_t PluginResource::GetNextSequence() { 111 int32_t PluginResource::GetNextSequence() {
111 // Return the value with wraparound, making sure we don't make a sequence 112 // Return the value with wraparound, making sure we don't make a sequence
112 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we 113 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we
113 // manually check. 114 // manually check.
114 int32_t ret = next_sequence_number_; 115 int32_t ret = next_sequence_number_;
115 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) 116 if (next_sequence_number_ == std::numeric_limits<int32_t>::max())
116 next_sequence_number_ = 1; // Skip 0 which is invalid. 117 next_sequence_number_ = 1; // Skip 0 which is invalid.
117 else 118 else
118 next_sequence_number_++; 119 next_sequence_number_++;
119 return ret; 120 return ret;
120 } 121 }
121 122
122 } // namespace proxy 123 } // namespace proxy
123 } // namespace ppapi 124 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698