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

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

Issue 11450025: Revert 171389 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('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/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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 bool PluginResource::SendResourceCall( 103 bool PluginResource::SendResourceCall(
104 Destination dest, 104 Destination dest,
105 const ResourceMessageCallParams& call_params, 105 const ResourceMessageCallParams& call_params,
106 const IPC::Message& nested_msg) { 106 const IPC::Message& nested_msg) {
107 return GetSender(dest)->Send( 107 return GetSender(dest)->Send(
108 new PpapiHostMsg_ResourceCall(call_params, nested_msg)); 108 new PpapiHostMsg_ResourceCall(call_params, nested_msg));
109 } 109 }
110 110
111 int32_t PluginResource::GenericSyncCall(Destination dest, 111 int32_t PluginResource::GenericSyncCall(
112 const IPC::Message& msg, 112 Destination dest,
113 IPC::Message* reply) { 113 const IPC::Message& msg,
114 IPC::Message* reply,
115 ResourceMessageReplyParams* reply_params) {
114 ResourceMessageCallParams params(pp_resource(), GetNextSequence()); 116 ResourceMessageCallParams params(pp_resource(), GetNextSequence());
115 params.set_has_callback(); 117 params.set_has_callback();
116 ResourceMessageReplyParams reply_params;
117 bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall( 118 bool success = GetSender(dest)->Send(new PpapiHostMsg_ResourceSyncCall(
118 params, msg, &reply_params, reply)); 119 params, msg, reply_params, reply));
119 if (success) 120 if (success)
120 return reply_params.result(); 121 return reply_params->result();
121 return PP_ERROR_FAILED; 122 return PP_ERROR_FAILED;
122 } 123 }
123 124
124 int32_t PluginResource::GetNextSequence() { 125 int32_t PluginResource::GetNextSequence() {
125 // Return the value with wraparound, making sure we don't make a sequence 126 // Return the value with wraparound, making sure we don't make a sequence
126 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we 127 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we
127 // manually check. 128 // manually check.
128 int32_t ret = next_sequence_number_; 129 int32_t ret = next_sequence_number_;
129 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) 130 if (next_sequence_number_ == std::numeric_limits<int32_t>::max())
130 next_sequence_number_ = 1; // Skip 0 which is invalid. 131 next_sequence_number_ = 1; // Skip 0 which is invalid.
131 else 132 else
132 next_sequence_number_++; 133 next_sequence_number_++;
133 return ret; 134 return ret;
134 } 135 }
135 136
136 } // namespace proxy 137 } // namespace proxy
137 } // namespace ppapi 138 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698