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

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

Issue 7995: Move Time, TimeDelta and TimeTicks into namespace base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
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>
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 232
233 return result; 233 return result;
234 } 234 }
235 static void Log(const param_type& p, std::wstring* l) { 235 static void Log(const param_type& p, std::wstring* l) {
236 l->append(StringPrintf(L"%lc", p)); 236 l->append(StringPrintf(L"%lc", p));
237 } 237 }
238 }; 238 };
239 239
240 template <> 240 template <>
241 struct ParamTraits<Time> { 241 struct ParamTraits<base::Time> {
242 typedef Time param_type; 242 typedef base::Time param_type;
243 static void Write(Message* m, const param_type& p) { 243 static void Write(Message* m, const param_type& p) {
244 ParamTraits<int64>::Write(m, p.ToInternalValue()); 244 ParamTraits<int64>::Write(m, p.ToInternalValue());
245 } 245 }
246 static bool Read(const Message* m, void** iter, param_type* r) { 246 static bool Read(const Message* m, void** iter, param_type* r) {
247 int64 value; 247 int64 value;
248 if (!ParamTraits<int64>::Read(m, iter, &value)) 248 if (!ParamTraits<int64>::Read(m, iter, &value))
249 return false; 249 return false;
250 *r = Time::FromInternalValue(value); 250 *r = base::Time::FromInternalValue(value);
251 return true; 251 return true;
252 } 252 }
253 static void Log(const param_type& p, std::wstring* l) { 253 static void Log(const param_type& p, std::wstring* l) {
254 ParamTraits<int64>::Log(p.ToInternalValue(), l); 254 ParamTraits<int64>::Log(p.ToInternalValue(), l);
255 } 255 }
256 }; 256 };
257 257
258 template <> 258 template <>
259 struct ParamTraits<LOGFONT> { 259 struct ParamTraits<LOGFONT> {
260 typedef LOGFONT param_type; 260 typedef LOGFONT param_type;
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 static void Log(const param_type& p, std::wstring* l); 629 static void Log(const param_type& p, std::wstring* l);
630 }; 630 };
631 631
632 template<> 632 template<>
633 struct ParamTraits<ThumbnailScore> { 633 struct ParamTraits<ThumbnailScore> {
634 typedef ThumbnailScore param_type; 634 typedef ThumbnailScore param_type;
635 static void Write(Message* m, const param_type& p) { 635 static void Write(Message* m, const param_type& p) {
636 IPC::ParamTraits<double>::Write(m, p.boring_score); 636 IPC::ParamTraits<double>::Write(m, p.boring_score);
637 IPC::ParamTraits<bool>::Write(m, p.good_clipping); 637 IPC::ParamTraits<bool>::Write(m, p.good_clipping);
638 IPC::ParamTraits<bool>::Write(m, p.at_top); 638 IPC::ParamTraits<bool>::Write(m, p.at_top);
639 IPC::ParamTraits<Time>::Write(m, p.time_at_snapshot); 639 IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot);
640 } 640 }
641 static bool Read(const Message* m, void** iter, param_type* r) { 641 static bool Read(const Message* m, void** iter, param_type* r) {
642 double boring_score; 642 double boring_score;
643 bool good_clipping, at_top; 643 bool good_clipping, at_top;
644 Time time_at_snapshot; 644 base::Time time_at_snapshot;
645 if (!IPC::ParamTraits<double>::Read(m, iter, &boring_score) || 645 if (!IPC::ParamTraits<double>::Read(m, iter, &boring_score) ||
646 !IPC::ParamTraits<bool>::Read(m, iter, &good_clipping) || 646 !IPC::ParamTraits<bool>::Read(m, iter, &good_clipping) ||
647 !IPC::ParamTraits<bool>::Read(m, iter, &at_top) || 647 !IPC::ParamTraits<bool>::Read(m, iter, &at_top) ||
648 !IPC::ParamTraits<Time>::Read(m, iter, &time_at_snapshot)) 648 !IPC::ParamTraits<base::Time>::Read(m, iter, &time_at_snapshot))
649 return false; 649 return false;
650 650
651 r->boring_score = boring_score; 651 r->boring_score = boring_score;
652 r->good_clipping = good_clipping; 652 r->good_clipping = good_clipping;
653 r->at_top = at_top; 653 r->at_top = at_top;
654 r->time_at_snapshot = time_at_snapshot; 654 r->time_at_snapshot = time_at_snapshot;
655 return true; 655 return true;
656 } 656 }
657 static void Log(const param_type& p, std::wstring* l) { 657 static void Log(const param_type& p, std::wstring* l) {
658 l->append(StringPrintf(L"(%f, %d, %d)", 658 l->append(StringPrintf(L"(%f, %d, %d)",
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 l->append(L"<FindInPageRequest>"); 1246 l->append(L"<FindInPageRequest>");
1247 } 1247 }
1248 }; 1248 };
1249 1249
1250 //----------------------------------------------------------------------------- 1250 //-----------------------------------------------------------------------------
1251 1251
1252 } // namespace IPC 1252 } // namespace IPC
1253 1253
1254 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 1254 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_
1255 1255
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698