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

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

Issue 1149113006: Move Pickle to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/proxy/raw_var_data.h ('k') | ppapi/proxy/serialized_flash_menu.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 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ 5 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_
6 #define PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ 6 #define PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Appends the given handle to the list of handles sent with the call or 67 // Appends the given handle to the list of handles sent with the call or
68 // reply. 68 // reply.
69 void AppendHandle(const SerializedHandle& handle) const; 69 void AppendHandle(const SerializedHandle& handle) const;
70 70
71 protected: 71 protected:
72 ResourceMessageParams(); 72 ResourceMessageParams();
73 ResourceMessageParams(PP_Resource resource, int32_t sequence); 73 ResourceMessageParams(PP_Resource resource, int32_t sequence);
74 74
75 virtual void Serialize(IPC::Message* msg) const; 75 virtual void Serialize(IPC::Message* msg) const;
76 virtual bool Deserialize(const IPC::Message* msg, PickleIterator* iter); 76 virtual bool Deserialize(const IPC::Message* msg, base::PickleIterator* iter);
77 77
78 // Writes everything except the handles to |msg|. 78 // Writes everything except the handles to |msg|.
79 void WriteHeader(IPC::Message* msg) const; 79 void WriteHeader(IPC::Message* msg) const;
80 // Writes the handles to |msg|. 80 // Writes the handles to |msg|.
81 void WriteHandles(IPC::Message* msg) const; 81 void WriteHandles(IPC::Message* msg) const;
82 // Matching deserialize helpers. 82 // Matching deserialize helpers.
83 bool ReadHeader(const IPC::Message* msg, PickleIterator* iter); 83 bool ReadHeader(const IPC::Message* msg, base::PickleIterator* iter);
84 bool ReadHandles(const IPC::Message* msg, PickleIterator* iter); 84 bool ReadHandles(const IPC::Message* msg, base::PickleIterator* iter);
85 85
86 private: 86 private:
87 class PPAPI_PROXY_EXPORT SerializedHandles 87 class PPAPI_PROXY_EXPORT SerializedHandles
88 : public base::RefCountedThreadSafe<SerializedHandles> { 88 : public base::RefCountedThreadSafe<SerializedHandles> {
89 public: 89 public:
90 SerializedHandles(); 90 SerializedHandles();
91 ~SerializedHandles(); 91 ~SerializedHandles();
92 92
93 void set_should_close(bool value) { should_close_ = value; } 93 void set_should_close(bool value) { should_close_ = value; }
94 std::vector<SerializedHandle>& data() { return data_; } 94 std::vector<SerializedHandle>& data() { return data_; }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 : public ResourceMessageParams { 138 : public ResourceMessageParams {
139 public: 139 public:
140 ResourceMessageCallParams(); 140 ResourceMessageCallParams();
141 ResourceMessageCallParams(PP_Resource resource, int32_t sequence); 141 ResourceMessageCallParams(PP_Resource resource, int32_t sequence);
142 ~ResourceMessageCallParams() override; 142 ~ResourceMessageCallParams() override;
143 143
144 void set_has_callback() { has_callback_ = true; } 144 void set_has_callback() { has_callback_ = true; }
145 bool has_callback() const { return has_callback_; } 145 bool has_callback() const { return has_callback_; }
146 146
147 void Serialize(IPC::Message* msg) const override; 147 void Serialize(IPC::Message* msg) const override;
148 bool Deserialize(const IPC::Message* msg, PickleIterator* iter) override; 148 bool Deserialize(const IPC::Message* msg,
149 base::PickleIterator* iter) override;
149 150
150 private: 151 private:
151 bool has_callback_; 152 bool has_callback_;
152 }; 153 };
153 154
154 // Parameters common to all ResourceMessage "Reply" requests. 155 // Parameters common to all ResourceMessage "Reply" requests.
155 class PPAPI_PROXY_EXPORT ResourceMessageReplyParams 156 class PPAPI_PROXY_EXPORT ResourceMessageReplyParams
156 : public ResourceMessageParams { 157 : public ResourceMessageParams {
157 public: 158 public:
158 ResourceMessageReplyParams(); 159 ResourceMessageReplyParams();
159 ResourceMessageReplyParams(PP_Resource resource, int32_t sequence); 160 ResourceMessageReplyParams(PP_Resource resource, int32_t sequence);
160 ~ResourceMessageReplyParams() override; 161 ~ResourceMessageReplyParams() override;
161 162
162 void set_result(int32_t r) { result_ = r; } 163 void set_result(int32_t r) { result_ = r; }
163 int32_t result() const { return result_; } 164 int32_t result() const { return result_; }
164 165
165 void Serialize(IPC::Message* msg) const override; 166 void Serialize(IPC::Message* msg) const override;
166 bool Deserialize(const IPC::Message* msg, PickleIterator* iter) override; 167 bool Deserialize(const IPC::Message* msg,
168 base::PickleIterator* iter) override;
167 169
168 // Writes everything except the handles to |msg|. 170 // Writes everything except the handles to |msg|.
169 void WriteReplyHeader(IPC::Message* msg) const; 171 void WriteReplyHeader(IPC::Message* msg) const;
170 172
171 private: 173 private:
172 // Pepper "result code" for the callback. 174 // Pepper "result code" for the callback.
173 int32_t result_; 175 int32_t result_;
174 }; 176 };
175 177
176 } // namespace proxy 178 } // namespace proxy
177 } // namespace ppapi 179 } // namespace ppapi
178 180
179 namespace IPC { 181 namespace IPC {
180 182
181 template <> struct PPAPI_PROXY_EXPORT 183 template <> struct PPAPI_PROXY_EXPORT
182 ParamTraits<ppapi::proxy::ResourceMessageCallParams> { 184 ParamTraits<ppapi::proxy::ResourceMessageCallParams> {
183 typedef ppapi::proxy::ResourceMessageCallParams param_type; 185 typedef ppapi::proxy::ResourceMessageCallParams param_type;
184 static void Write(Message* m, const param_type& p) { 186 static void Write(Message* m, const param_type& p) {
185 p.Serialize(m); 187 p.Serialize(m);
186 } 188 }
187 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { 189 static bool Read(const Message* m, base::PickleIterator* iter,
190 param_type* r) {
188 return r->Deserialize(m, iter); 191 return r->Deserialize(m, iter);
189 } 192 }
190 static void Log(const param_type& p, std::string* l) { 193 static void Log(const param_type& p, std::string* l) {
191 } 194 }
192 }; 195 };
193 196
194 template <> struct PPAPI_PROXY_EXPORT 197 template <> struct PPAPI_PROXY_EXPORT
195 ParamTraits<ppapi::proxy::ResourceMessageReplyParams> { 198 ParamTraits<ppapi::proxy::ResourceMessageReplyParams> {
196 typedef ppapi::proxy::ResourceMessageReplyParams param_type; 199 typedef ppapi::proxy::ResourceMessageReplyParams param_type;
197 static void Write(Message* m, const param_type& p) { 200 static void Write(Message* m, const param_type& p) {
198 p.Serialize(m); 201 p.Serialize(m);
199 } 202 }
200 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { 203 static bool Read(const Message* m, base::PickleIterator* iter,
204 param_type* r) {
201 return r->Deserialize(m, iter); 205 return r->Deserialize(m, iter);
202 } 206 }
203 static void Log(const param_type& p, std::string* l) { 207 static void Log(const param_type& p, std::string* l) {
204 } 208 }
205 }; 209 };
206 210
207 } // namespace IPC 211 } // namespace IPC
208 212
209 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ 213 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/raw_var_data.h ('k') | ppapi/proxy/serialized_flash_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698