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

Unified Diff: chrome/common/webkit_param_traits.cc

Issue 3106018: Reapplies all the IPC system work (reverts the revert r56272). (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/webkit_param_traits.h ('k') | chrome/common/worker_messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/webkit_param_traits.cc
diff --git a/chrome/common/webkit_param_traits.cc b/chrome/common/webkit_param_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4a81d469a5a1be0a99406e4be7289b255925c95b
--- /dev/null
+++ b/chrome/common/webkit_param_traits.cc
@@ -0,0 +1,170 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/webkit_param_traits.h"
+
+#include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
+
+namespace IPC {
+
+void ParamTraits<WebKit::WebRect>::Write(Message* m, const param_type& p) {
+ WriteParam(m, p.x);
+ WriteParam(m, p.y);
+ WriteParam(m, p.width);
+ WriteParam(m, p.height);
+ }
+
+bool ParamTraits<WebKit::WebRect>::Read(const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->x) &&
+ ReadParam(m, iter, &p->y) &&
+ ReadParam(m, iter, &p->width) &&
+ ReadParam(m, iter, &p->height);
+}
+
+void ParamTraits<WebKit::WebRect>::Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.x, l);
+ l->append(L", ");
+ LogParam(p.y, l);
+ l->append(L", ");
+ LogParam(p.width, l);
+ l->append(L", ");
+ LogParam(p.height, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebScreenInfo>::Write(Message* m, const param_type& p) {
+ WriteParam(m, p.depth);
+ WriteParam(m, p.depthPerComponent);
+ WriteParam(m, p.isMonochrome);
+ WriteParam(m, p.rect);
+ WriteParam(m, p.availableRect);
+}
+
+bool ParamTraits<WebKit::WebScreenInfo>::Read(const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->depth) &&
+ ReadParam(m, iter, &p->depthPerComponent) &&
+ ReadParam(m, iter, &p->isMonochrome) &&
+ ReadParam(m, iter, &p->rect) &&
+ ReadParam(m, iter, &p->availableRect);
+}
+
+void ParamTraits<WebKit::WebScreenInfo>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.depth, l);
+ l->append(L", ");
+ LogParam(p.depthPerComponent, l);
+ l->append(L", ");
+ LogParam(p.isMonochrome, l);
+ l->append(L", ");
+ LogParam(p.rect, l);
+ l->append(L", ");
+ LogParam(p.availableRect, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebFindOptions>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.forward);
+ WriteParam(m, p.matchCase);
+ WriteParam(m, p.findNext);
+}
+
+bool ParamTraits<WebKit::WebFindOptions>::Read(const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->forward) &&
+ ReadParam(m, iter, &p->matchCase) &&
+ ReadParam(m, iter, &p->findNext);
+}
+
+void ParamTraits<WebKit::WebFindOptions>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.forward, l);
+ l->append(L", ");
+ LogParam(p.matchCase, l);
+ l->append(L", ");
+ LogParam(p.findNext, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebMediaPlayerAction>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, static_cast<int>(p.type));
+ WriteParam(m, p.enable);
+}
+
+bool ParamTraits<WebKit::WebMediaPlayerAction>::Read(const Message* m,
+ void** iter,
+ param_type* r) {
+ int temp;
+ if (!ReadParam(m, iter, &temp))
+ return false;
+ r->type = static_cast<param_type::Type>(temp);
+ return ReadParam(m, iter, &r->enable);
+}
+
+void ParamTraits<WebKit::WebMediaPlayerAction>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ switch (p.type) {
+ case WebKit::WebMediaPlayerAction::Play:
+ l->append(L"Play");
+ break;
+ case WebKit::WebMediaPlayerAction::Mute:
+ l->append(L"Mute");
+ break;
+ case WebKit::WebMediaPlayerAction::Loop:
+ l->append(L"Loop");
+ break;
+ default:
+ l->append(L"Unknown");
+ break;
+ }
+ l->append(L", ");
+ LogParam(p.enable, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebCompositionUnderline>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.startOffset);
+ WriteParam(m, p.endOffset);
+ WriteParam(m, p.color);
+ WriteParam(m, p.thick);
+}
+
+bool ParamTraits<WebKit::WebCompositionUnderline>::Read(
+ const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->startOffset) &&
+ ReadParam(m, iter, &p->endOffset) &&
+ ReadParam(m, iter, &p->color) &&
+ ReadParam(m, iter, &p->thick);
+}
+
+void ParamTraits<WebKit::WebCompositionUnderline>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.startOffset, l);
+ l->append(L",");
+ LogParam(p.endOffset, l);
+ l->append(L":");
+ LogParam(p.color, l);
+ l->append(L":");
+ LogParam(p.thick, l);
+ l->append(L")");
+}
+
+} // namespace IPC
« no previous file with comments | « chrome/common/webkit_param_traits.h ('k') | chrome/common/worker_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698