OLD | NEW |
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_SERIALIZED_VAR_H_ | 5 #ifndef PPAPI_PROXY_SERIALIZED_VAR_H_ |
6 #define PPAPI_PROXY_SERIALIZED_VAR_H_ | 6 #define PPAPI_PROXY_SERIALIZED_VAR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "ppapi/c/pp_var.h" | 14 #include "ppapi/c/pp_var.h" |
15 #include "ppapi/proxy/ppapi_proxy_export.h" | 15 #include "ppapi/proxy/ppapi_proxy_export.h" |
16 | 16 |
| 17 class PickleIterator; |
| 18 |
17 namespace IPC { | 19 namespace IPC { |
18 class Message; | 20 class Message; |
19 } | 21 } |
20 | 22 |
21 namespace ppapi { | 23 namespace ppapi { |
22 namespace proxy { | 24 namespace proxy { |
23 | 25 |
24 class Dispatcher; | 26 class Dispatcher; |
25 class VarSerializationRules; | 27 class VarSerializationRules; |
26 | 28 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // behavior and will enforce that you don't do stupid things. | 67 // behavior and will enforce that you don't do stupid things. |
66 class PPAPI_PROXY_EXPORT SerializedVar { | 68 class PPAPI_PROXY_EXPORT SerializedVar { |
67 public: | 69 public: |
68 SerializedVar(); | 70 SerializedVar(); |
69 ~SerializedVar(); | 71 ~SerializedVar(); |
70 | 72 |
71 // Backend implementation for IPC::ParamTraits<SerializedVar>. | 73 // Backend implementation for IPC::ParamTraits<SerializedVar>. |
72 void WriteToMessage(IPC::Message* m) const { | 74 void WriteToMessage(IPC::Message* m) const { |
73 inner_->WriteToMessage(m); | 75 inner_->WriteToMessage(m); |
74 } | 76 } |
75 bool ReadFromMessage(const IPC::Message* m, void** iter) { | 77 bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter) { |
76 return inner_->ReadFromMessage(m, iter); | 78 return inner_->ReadFromMessage(m, iter); |
77 } | 79 } |
78 | 80 |
79 protected: | 81 protected: |
80 friend class SerializedVarReceiveInput; | 82 friend class SerializedVarReceiveInput; |
81 friend class SerializedVarReturnValue; | 83 friend class SerializedVarReturnValue; |
82 friend class SerializedVarOutParam; | 84 friend class SerializedVarOutParam; |
83 friend class SerializedVarSendInput; | 85 friend class SerializedVarSendInput; |
84 friend class SerializedVarTestConstructor; | 86 friend class SerializedVarTestConstructor; |
85 friend class SerializedVarVectorReceiveInput; | 87 friend class SerializedVarVectorReceiveInput; |
(...skipping 13 matching lines...) Expand all Loading... |
99 | 101 |
100 // See outer class's declarations above. | 102 // See outer class's declarations above. |
101 PP_Var GetVar() const; | 103 PP_Var GetVar() const; |
102 void SetVar(PP_Var var); | 104 void SetVar(PP_Var var); |
103 | 105 |
104 // For the SerializedVarTestConstructor, this writes the Var value as if | 106 // For the SerializedVarTestConstructor, this writes the Var value as if |
105 // it was just received off the wire, without any serialization rules. | 107 // it was just received off the wire, without any serialization rules. |
106 void ForceSetVarValueForTest(PP_Var value); | 108 void ForceSetVarValueForTest(PP_Var value); |
107 | 109 |
108 void WriteToMessage(IPC::Message* m) const; | 110 void WriteToMessage(IPC::Message* m) const; |
109 bool ReadFromMessage(const IPC::Message* m, void** iter); | 111 bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter); |
110 | 112 |
111 // Sets the cleanup mode. See the CleanupMode enum below. These functions | 113 // Sets the cleanup mode. See the CleanupMode enum below. These functions |
112 // are not just a simple setter in order to require that the appropriate | 114 // are not just a simple setter in order to require that the appropriate |
113 // data is set along with the corresponding mode. | 115 // data is set along with the corresponding mode. |
114 void SetCleanupModeToEndSendPassRef(Dispatcher* dispatcher); | 116 void SetCleanupModeToEndSendPassRef(Dispatcher* dispatcher); |
115 void SetCleanupModeToEndReceiveCallerOwned(); | 117 void SetCleanupModeToEndReceiveCallerOwned(); |
116 | 118 |
117 private: | 119 private: |
118 enum CleanupMode { | 120 enum CleanupMode { |
119 // The serialized var won't do anything special in the destructor | 121 // The serialized var won't do anything special in the destructor |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // IDs have not yet been converted, so this is the thing that tests will | 445 // IDs have not yet been converted, so this is the thing that tests will |
444 // actually want to check. | 446 // actually want to check. |
445 PP_Var GetVar() const { return inner_->GetVar(); } | 447 PP_Var GetVar() const { return inner_->GetVar(); } |
446 }; | 448 }; |
447 | 449 |
448 } // namespace proxy | 450 } // namespace proxy |
449 } // namespace ppapi | 451 } // namespace ppapi |
450 | 452 |
451 #endif // PPAPI_PROXY_SERIALIZED_VAR_H_ | 453 #endif // PPAPI_PROXY_SERIALIZED_VAR_H_ |
452 | 454 |
OLD | NEW |