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

Unified Diff: chrome/common/webkit_param_traits.h

Issue 6713084: Move the rest of the renderer->browser messages that belong in content. Also do a bunch of cleanup: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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/utility_messages.h ('k') | chrome/common/webkit_param_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/webkit_param_traits.h
===================================================================
--- chrome/common/webkit_param_traits.h (revision 79188)
+++ chrome/common/webkit_param_traits.h (working copy)
@@ -1,168 +0,0 @@
-// 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.
-
-// This file contains ParamTraits templates to support serialization of WebKit
-// data types over IPC.
-//
-// NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED.
-//
-// There are several reasons for this restrictions:
-//
-// o We don't want inclusion of this file to imply linking to WebKit code.
-//
-// o Many WebKit structures are not thread-safe. WebString, for example,
-// contains a reference counted buffer, which does not use thread-safe
-// reference counting. If we allowed serializing WebString, then we may
-// run the risk of introducing subtle thread-safety bugs if people passed a
-// WebString across threads via PostTask(NewRunnableMethod(...)).
-//
-// o The WebKit API has redundant types for strings, and we should avoid
-// using those beyond code that interfaces with the WebKit API.
-
-#ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
-#define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
-#pragma once
-
-#include "ipc/ipc_message_utils.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h"
-
-namespace WebKit {
-struct WebRect;
-}
-
-namespace IPC {
-
-template <>
-struct SimilarTypeTraits<WebKit::WebConsoleMessage::Level> {
- typedef int Type;
-};
-
-template <>
-struct ParamTraits<WebKit::WebCache::UsageStats> {
- typedef WebKit::WebCache::UsageStats param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.minDeadCapacity);
- WriteParam(m, p.maxDeadCapacity);
- WriteParam(m, p.capacity);
- WriteParam(m, p.liveSize);
- WriteParam(m, p.deadSize);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->minDeadCapacity) &&
- ReadParam(m, iter, &r->maxDeadCapacity) &&
- ReadParam(m, iter, &r->capacity) &&
- ReadParam(m, iter, &r->liveSize) &&
- ReadParam(m, iter, &r->deadSize);
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<WebCache::UsageStats>");
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebCache::ResourceTypeStat> {
- typedef WebKit::WebCache::ResourceTypeStat param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.count);
- WriteParam(m, p.size);
- WriteParam(m, p.liveSize);
- WriteParam(m, p.decodedSize);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool result =
- ReadParam(m, iter, &r->count) &&
- ReadParam(m, iter, &r->size) &&
- ReadParam(m, iter, &r->liveSize) &&
- ReadParam(m, iter, &r->decodedSize);
- return result;
- }
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct ParamTraits<WebKit::WebCache::ResourceTypeStats> {
- typedef WebKit::WebCache::ResourceTypeStats param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.images);
- WriteParam(m, p.cssStyleSheets);
- WriteParam(m, p.scripts);
- WriteParam(m, p.xslStyleSheets);
- WriteParam(m, p.fonts);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool result =
- ReadParam(m, iter, &r->images) &&
- ReadParam(m, iter, &r->cssStyleSheets) &&
- ReadParam(m, iter, &r->scripts) &&
- ReadParam(m, iter, &r->xslStyleSheets) &&
- ReadParam(m, iter, &r->fonts);
- return result;
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<WebCoreStats>");
- LogParam(p.images, l);
- LogParam(p.cssStyleSheets, l);
- LogParam(p.scripts, l);
- LogParam(p.xslStyleSheets, l);
- LogParam(p.fonts, l);
- l->append("</WebCoreStats>");
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebTextInputType> {
- typedef WebKit::WebTextInputType param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- std::string control;
- switch (p) {
- case WebKit::WebTextInputTypeNone:
- control = "WebKit::WebTextInputTypeNone";
- break;
- case WebKit::WebTextInputTypeText:
- control = "WebKit::WebTextInputTypeText";
- break;
- case WebKit::WebTextInputTypePassword:
- control = "WebKit::WebTextInputTypePassword";
- break;
- default:
- NOTIMPLEMENTED();
- control = "UNKNOWN";
- break;
- }
- LogParam(control, l);
- }
-};
-
-template <>
-struct SimilarTypeTraits<WebKit::WebFileError> {
- typedef int Type;
-};
-
-template <>
-struct ParamTraits<WebKit::WebTextCheckingResult> {
- typedef WebKit::WebTextCheckingResult param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::string* l);
-};
-
-} // namespace IPC
-
-#endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
« no previous file with comments | « chrome/common/utility_messages.h ('k') | chrome/common/webkit_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698