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

Side by Side Diff: chrome/common/ipc_message_utils.h

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 years, 10 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 5 #ifndef CHROME_COMMON_IPC_MESSAGE_UTILS_H_
6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <map> 10 #include <map>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/tuple.h" 14 #include "base/tuple.h"
15 #if defined(OS_POSIX) 15 #if defined(OS_POSIX)
16 #include "chrome/common/file_descriptor_set_posix.h" 16 #include "chrome/common/file_descriptor_set_posix.h"
17 #endif 17 #endif
18 #include "chrome/common/ipc_maybe.h"
18 #include "chrome/common/ipc_sync_message.h" 19 #include "chrome/common/ipc_sync_message.h"
19 #include "chrome/common/thumbnail_score.h" 20 #include "chrome/common/thumbnail_score.h"
21 #include "chrome/common/transport_dib.h"
20 #include "webkit/glue/cache_manager.h" 22 #include "webkit/glue/cache_manager.h"
21 #include "webkit/glue/console_message_level.h" 23 #include "webkit/glue/console_message_level.h"
22 #include "webkit/glue/find_in_page_request.h" 24 #include "webkit/glue/find_in_page_request.h"
23 #include "webkit/glue/webcursor.h" 25 #include "webkit/glue/webcursor.h"
24 #include "webkit/glue/window_open_disposition.h" 26 #include "webkit/glue/window_open_disposition.h"
25 27
26 // Forward declarations. 28 // Forward declarations.
27 class GURL; 29 class GURL;
28 class SkBitmap; 30 class SkBitmap;
29 31
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 LogParam(p.c, l); 1040 LogParam(p.c, l);
1039 l->append(L", "); 1041 l->append(L", ");
1040 LogParam(p.d, l); 1042 LogParam(p.d, l);
1041 l->append(L", "); 1043 l->append(L", ");
1042 LogParam(p.e, l); 1044 LogParam(p.e, l);
1043 l->append(L", "); 1045 l->append(L", ");
1044 LogParam(p.f, l); 1046 LogParam(p.f, l);
1045 } 1047 }
1046 }; 1048 };
1047 1049
1050 #if defined(OS_WIN)
1051 template<>
1052 struct ParamTraits<TransportDIB::Id> {
1053 typedef TransportDIB::Id param_type;
1054 static void Write(Message* m, const param_type& p) {
1055 WriteParam(m, p.handle);
1056 WriteParam(m, p.sequence_num);
1057 }
1058 static bool Read(const Message* m, void** iter, param_type* r) {
1059 return (ReadParam(m, iter, &r->handle) &&
1060 ReadParam(m, iter, &r->sequence_num));
1061 }
1062 static void Log(const param_type& p, std::wstring* l) {
1063 l->append(L"TransportDIB(");
1064 LogParam(p.handle, l);
1065 l->append(L", ");
1066 LogParam(p.sequence_num, l);
1067 l->append(L")");
1068 }
1069 };
1070 #endif
1071
1072 template<typename A>
1073 struct ParamTraits<Maybe<A> > {
1074 typedef struct Maybe<A> param_type;
1075 static void Write(Message* m, const param_type& p) {
1076 WriteParam(m, p.valid);
1077 if (p.valid)
1078 WriteParam(m, p.value);
1079 }
1080 static bool Read(const Message* m, void** iter, param_type* r) {
1081 if (!ReadParam(m, iter, &r->valid))
1082 return false;
1083
1084 if (r->valid)
1085 return ReadParam(m, iter, &r->value);
1086 return true;
1087 }
1088 static void Log(const param_type& p, std::wstring* l) {
1089 if (p.valid) {
1090 l->append(L"Just ");
1091 ParamTraits<A>::Log(p.value, l);
1092 } else {
1093 l->append(L"Nothing");
1094 }
1095
1096 }
1097 };
1098
1048 template <> 1099 template <>
1049 struct ParamTraits<webkit_glue::WebApplicationInfo> { 1100 struct ParamTraits<webkit_glue::WebApplicationInfo> {
1050 typedef webkit_glue::WebApplicationInfo param_type; 1101 typedef webkit_glue::WebApplicationInfo param_type;
1051 static void Write(Message* m, const param_type& p); 1102 static void Write(Message* m, const param_type& p);
1052 static bool Read(const Message* m, void** iter, param_type* r); 1103 static bool Read(const Message* m, void** iter, param_type* r);
1053 static void Log(const param_type& p, std::wstring* l); 1104 static void Log(const param_type& p, std::wstring* l);
1054 }; 1105 };
1055 1106
1056 1107
1057 //----------------------------------------------------------------------------- 1108 //-----------------------------------------------------------------------------
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 l->append(L"<FindInPageRequest>"); 1417 l->append(L"<FindInPageRequest>");
1367 } 1418 }
1368 }; 1419 };
1369 1420
1370 //----------------------------------------------------------------------------- 1421 //-----------------------------------------------------------------------------
1371 1422
1372 } // namespace IPC 1423 } // namespace IPC
1373 1424
1374 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 1425 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_
1375 1426
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698