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

Side by Side Diff: ipc/ipc_message_utils.h

Issue 174484: Add a nullable string16 class to base. It combines a string16 + a null param... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/renderer_webstoragearea_impl.cc ('k') | webkit/api/public/WebString.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 IPC_IPC_MESSAGE_UTILS_H_ 5 #ifndef IPC_IPC_MESSAGE_UTILS_H_
6 #define IPC_IPC_MESSAGE_UTILS_H_ 6 #define IPC_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/format_macros.h" 13 #include "base/format_macros.h"
14 #include "base/nullable_string16.h"
14 #include "base/string16.h" 15 #include "base/string16.h"
15 #include "base/string_util.h" 16 #include "base/string_util.h"
16 #include "base/time.h" 17 #include "base/time.h"
17 #include "base/tuple.h" 18 #include "base/tuple.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #if defined(OS_POSIX) 20 #if defined(OS_POSIX)
20 #include "ipc/file_descriptor_set_posix.h" 21 #include "ipc/file_descriptor_set_posix.h"
21 #endif 22 #endif
22 #include "ipc/ipc_channel_handle.h" 23 #include "ipc/ipc_channel_handle.h"
23 #include "ipc/ipc_sync_message.h" 24 #include "ipc/ipc_sync_message.h"
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 539 }
539 static void Log(const param_type& p, std::wstring* l) { 540 static void Log(const param_type& p, std::wstring* l) {
540 l->append(L"("); 541 l->append(L"(");
541 LogParam(p.first, l); 542 LogParam(p.first, l);
542 l->append(L", "); 543 l->append(L", ");
543 LogParam(p.second, l); 544 LogParam(p.second, l);
544 l->append(L")"); 545 l->append(L")");
545 } 546 }
546 }; 547 };
547 548
549 template <>
550 struct ParamTraits<NullableString16> {
551 typedef NullableString16 param_type;
552 static void Write(Message* m, const param_type& p) {
553 WriteParam(m, p.string());
554 WriteParam(m, p.is_null());
555 }
556 static bool Read(const Message* m, void** iter, param_type* r) {
557 string16 string;
558 if (!ReadParam(m, iter, &string))
559 return false;
560 bool is_null;
561 if (!ReadParam(m, iter, &is_null))
562 return false;
563 *r = NullableString16(string, is_null);
564 return true;
565 }
566 static void Log(const param_type& p, std::wstring* l) {
567 l->append(L"(");
568 LogParam(p.string(), l);
569 l->append(L", ");
570 LogParam(p.is_null(), l);
571 l->append(L")");
572 }
573 };
574
548 // If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't 575 // If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't
549 // need this trait. 576 // need this trait.
550 #if !defined(WCHAR_T_IS_UTF16) 577 #if !defined(WCHAR_T_IS_UTF16)
551 template <> 578 template <>
552 struct ParamTraits<string16> { 579 struct ParamTraits<string16> {
553 typedef string16 param_type; 580 typedef string16 param_type;
554 static void Write(Message* m, const param_type& p) { 581 static void Write(Message* m, const param_type& p) {
555 m->WriteString16(p); 582 m->WriteString16(p);
556 } 583 }
557 static bool Read(const Message* m, void** iter, param_type* r) { 584 static bool Read(const Message* m, void** iter, param_type* r) {
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 ReplyParam p(a, b, c, d, e); 1260 ReplyParam p(a, b, c, d, e);
1234 WriteParam(reply, p); 1261 WriteParam(reply, p);
1235 } 1262 }
1236 }; 1263 };
1237 1264
1238 //----------------------------------------------------------------------------- 1265 //-----------------------------------------------------------------------------
1239 1266
1240 } // namespace IPC 1267 } // namespace IPC
1241 1268
1242 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1269 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_webstoragearea_impl.cc ('k') | webkit/api/public/WebString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698