summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/utility_process_host.cc1
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/common/indexed_db_param_traits.cc96
-rw-r--r--chrome/common/indexed_db_param_traits.h83
-rw-r--r--chrome/common/render_messages.cc2
-rw-r--r--chrome/common/utility_messages.cc2
-rw-r--r--chrome/common/utility_messages_internal.h2
-rw-r--r--chrome/utility/utility_thread.cc1
8 files changed, 116 insertions, 73 deletions
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc
index a5e80fe..f7e84ce 100644
--- a/chrome/browser/utility_process_host.cc
+++ b/chrome/browser/utility_process_host.cc
@@ -11,6 +11,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/indexed_db_key.h"
#include "chrome/common/utility_messages.h"
#include "ipc/ipc_switches.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index b0c4547..b076ff6 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -68,6 +68,8 @@
'common/gpu_video_common.h',
'common/indexed_db_key.cc',
'common/indexed_db_key.h',
+ 'common/indexed_db_param_traits.cc',
+ 'common/indexed_db_param_traits.h',
'common/logging_chrome.cc',
'common/logging_chrome.h',
'common/main_function_params.h',
diff --git a/chrome/common/indexed_db_param_traits.cc b/chrome/common/indexed_db_param_traits.cc
new file mode 100644
index 0000000..fd47ecf
--- /dev/null
+++ b/chrome/common/indexed_db_param_traits.cc
@@ -0,0 +1,96 @@
+// 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/indexed_db_param_traits.h"
+
+#include "chrome/common/indexed_db_key.h"
+#include "chrome/common/serialized_script_value.h"
+#include "ipc/ipc_message_utils.h"
+
+namespace IPC {
+
+void ParamTraits<SerializedScriptValue>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.is_null());
+ WriteParam(m, p.is_invalid());
+ WriteParam(m, p.data());
+}
+
+bool ParamTraits<SerializedScriptValue>::Read(const Message* m,
+ void** iter,
+ param_type* r) {
+ bool is_null;
+ bool is_invalid;
+ string16 data;
+ bool ok =
+ ReadParam(m, iter, &is_null) &&
+ ReadParam(m, iter, &is_invalid) &&
+ ReadParam(m, iter, &data);
+ if (!ok)
+ return false;
+ r->set_is_null(is_null);
+ r->set_is_invalid(is_invalid);
+ r->set_data(data);
+ return true;
+}
+
+void ParamTraits<SerializedScriptValue>::Log(const param_type& p,
+ std::string* l) {
+ l->append("<SerializedScriptValue>(");
+ LogParam(p.is_null(), l);
+ l->append(", ");
+ LogParam(p.is_invalid(), l);
+ l->append(", ");
+ LogParam(p.data(), l);
+ l->append(")");
+}
+
+void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) {
+ WriteParam(m, int(p.type()));
+ // TODO(jorlow): Technically, we only need to pack the type being used.
+ WriteParam(m, p.string());
+ WriteParam(m, p.number());
+}
+
+bool ParamTraits<IndexedDBKey>::Read(const Message* m,
+ void** iter,
+ param_type* r) {
+ int type;
+ string16 string;
+ int32 number;
+ bool ok =
+ ReadParam(m, iter, &type) &&
+ ReadParam(m, iter, &string) &&
+ ReadParam(m, iter, &number);
+ if (!ok)
+ return false;
+ switch (type) {
+ case WebKit::WebIDBKey::NullType:
+ r->SetNull();
+ return true;
+ case WebKit::WebIDBKey::StringType:
+ r->Set(string);
+ return true;
+ case WebKit::WebIDBKey::NumberType:
+ r->Set(number);
+ return true;
+ case WebKit::WebIDBKey::InvalidType:
+ r->SetInvalid();
+ return true;
+ }
+ NOTREACHED();
+ return false;
+}
+
+void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) {
+ l->append("<IndexedDBKey>(");
+ LogParam(int(p.type()), l);
+ l->append(", ");
+ LogParam(p.string(), l);
+ l->append(", ");
+ LogParam(p.number(), l);
+ l->append(")");
+}
+
+} // namespace IPC
diff --git a/chrome/common/indexed_db_param_traits.h b/chrome/common/indexed_db_param_traits.h
index 4936944..2e43f3e 100644
--- a/chrome/common/indexed_db_param_traits.h
+++ b/chrome/common/indexed_db_param_traits.h
@@ -6,10 +6,12 @@
#define CHROME_COMMON_INDEXED_DB_PARAM_TRAITS_H_
#pragma once
-#include "chrome/common/indexed_db_key.h"
-#include "chrome/common/serialized_script_value.h"
+#include "ipc/ipc_message.h"
#include "ipc/ipc_param_traits.h"
+class IndexedDBKey;
+class SerializedScriptValue;
+
namespace IPC {
// These datatypes are used by utility_messages.h and render_messages.h.
@@ -20,82 +22,17 @@ namespace IPC {
template <>
struct ParamTraits<SerializedScriptValue> {
typedef SerializedScriptValue param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.is_null());
- WriteParam(m, p.is_invalid());
- WriteParam(m, p.data());
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool is_null;
- bool is_invalid;
- string16 data;
- bool ok =
- ReadParam(m, iter, &is_null) &&
- ReadParam(m, iter, &is_invalid) &&
- ReadParam(m, iter, &data);
- if (!ok)
- return false;
- r->set_is_null(is_null);
- r->set_is_invalid(is_invalid);
- r->set_data(data);
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<SerializedScriptValue>(");
- LogParam(p.is_null(), l);
- l->append(", ");
- LogParam(p.is_invalid(), l);
- l->append(", ");
- LogParam(p.data(), l);
- l->append(")");
- }
+ 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);
};
template <>
struct ParamTraits<IndexedDBKey> {
typedef IndexedDBKey param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, int(p.type()));
- // TODO(jorlow): Technically, we only need to pack the type being used.
- WriteParam(m, p.string());
- WriteParam(m, p.number());
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- int type;
- string16 string;
- int32 number;
- bool ok =
- ReadParam(m, iter, &type) &&
- ReadParam(m, iter, &string) &&
- ReadParam(m, iter, &number);
- if (!ok)
- return false;
- switch (type) {
- case WebKit::WebIDBKey::NullType:
- r->SetNull();
- return true;
- case WebKit::WebIDBKey::StringType:
- r->Set(string);
- return true;
- case WebKit::WebIDBKey::NumberType:
- r->Set(number);
- return true;
- case WebKit::WebIDBKey::InvalidType:
- r->SetInvalid();
- return true;
- }
- NOTREACHED();
- return false;
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<IndexedDBKey>(");
- LogParam(int(p.type()), l);
- l->append(", ");
- LogParam(p.string(), l);
- l->append(", ");
- LogParam(p.number(), l);
- l->append(")");
- }
+ 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
diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc
index 88bba47..4947e9d 100644
--- a/chrome/common/render_messages.cc
+++ b/chrome/common/render_messages.cc
@@ -9,8 +9,10 @@
#include "chrome/common/extensions/extension_extent.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/gpu_param_traits.h"
+#include "chrome/common/indexed_db_key.h"
#include "chrome/common/indexed_db_param_traits.h"
#include "chrome/common/render_messages_params.h"
+#include "chrome/common/serialized_script_value.h"
#include "chrome/common/thumbnail_score.h"
#include "gfx/rect.h"
#include "ipc/ipc_channel_handle.h"
diff --git a/chrome/common/utility_messages.cc b/chrome/common/utility_messages.cc
index 4a781c3..b0cd5cc 100644
--- a/chrome/common/utility_messages.cc
+++ b/chrome/common/utility_messages.cc
@@ -6,6 +6,8 @@
#include "base/values.h"
#include "chrome/common/common_param_traits.h"
+#include "chrome/common/indexed_db_key.h"
+#include "chrome/common/serialized_script_value.h"
#include "base/file_path.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/common/utility_messages_internal.h b/chrome/common/utility_messages_internal.h
index 1fb6698..15bd8d6 100644
--- a/chrome/common/utility_messages_internal.h
+++ b/chrome/common/utility_messages_internal.h
@@ -19,6 +19,8 @@
#include "printing/page_range.h"
class FilePath;
+class IndexedDBKey;
+class SerializedScriptValue;
class SkBitmap;
//------------------------------------------------------------------------------
diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc
index 11d8b3f..ac8de68 100644
--- a/chrome/utility/utility_thread.cc
+++ b/chrome/utility/utility_thread.cc
@@ -17,6 +17,7 @@
#include "chrome/common/extensions/extension_unpacker.h"
#include "chrome/common/extensions/update_manifest.h"
#include "chrome/common/indexed_db_key.h"
+#include "chrome/common/serialized_script_value.h"
#include "chrome/common/utility_messages.h"
#include "chrome/common/web_resource/web_resource_unpacker.h"
#include "gfx/rect.h"