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

Side by Side Diff: ipc/ipc_message_utils.h

Issue 7990005: Use a placeholder instead of the default plugin for missing plug-ins on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 9 years, 2 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 | « content/common/webkit_param_traits.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 r->resize(data_size); 490 r->resize(data_size);
491 if (data_size) 491 if (data_size)
492 memcpy(&r->front(), data, data_size); 492 memcpy(&r->front(), data, data_size);
493 return true; 493 return true;
494 } 494 }
495 static void Log(const param_type& p, std::string* l) { 495 static void Log(const param_type& p, std::string* l) {
496 LogBytes(p, l); 496 LogBytes(p, l);
497 } 497 }
498 }; 498 };
499 499
500 template <>
501 struct ParamTraits<std::vector<bool> > {
502 typedef std::vector<bool> param_type;
503 static void Write(Message* m, const param_type& p) {
504 WriteParam(m, static_cast<int>(p.size()));
505 for (size_t i = 0; i < p.size(); i++)
506 WriteParam(m, p[i]);
507 }
508 static bool Read(const Message* m, void** iter, param_type* r) {
509 int size;
510 // ReadLength() checks for < 0 itself.
511 if (!m->ReadLength(iter, &size))
512 return false;
513 r->resize(size);
514 for (int i = 0; i < size; i++) {
515 bool value;
516 if (!ReadParam(m, iter, &value))
517 return false;
518 (*r)[i] = value;
519 }
520 return true;
521 }
522 static void Log(const param_type& p, std::string* l) {
523 for (size_t i = 0; i < p.size(); ++i) {
524 if (i != 0)
525 l->append(" ");
526 LogParam((p[i]), l);
527 }
528 }
529 };
530
500 template <class P> 531 template <class P>
501 struct ParamTraits<std::vector<P> > { 532 struct ParamTraits<std::vector<P> > {
502 typedef std::vector<P> param_type; 533 typedef std::vector<P> param_type;
503 static void Write(Message* m, const param_type& p) { 534 static void Write(Message* m, const param_type& p) {
504 WriteParam(m, static_cast<int>(p.size())); 535 WriteParam(m, static_cast<int>(p.size()));
505 for (size_t i = 0; i < p.size(); i++) 536 for (size_t i = 0; i < p.size(); i++)
506 WriteParam(m, p[i]); 537 WriteParam(m, p[i]);
507 } 538 }
508 static bool Read(const Message* m, void** iter, param_type* r) { 539 static bool Read(const Message* m, void** iter, param_type* r) {
509 int size; 540 int size;
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 ReplyParam p(a, b, c, d, e); 1136 ReplyParam p(a, b, c, d, e);
1106 WriteParam(reply, p); 1137 WriteParam(reply, p);
1107 } 1138 }
1108 }; 1139 };
1109 1140
1110 //----------------------------------------------------------------------------- 1141 //-----------------------------------------------------------------------------
1111 1142
1112 } // namespace IPC 1143 } // namespace IPC
1113 1144
1114 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1145 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « content/common/webkit_param_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698