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

Unified Diff: chrome/common/render_messages.cc

Issue 6681028: Move the blob related code to content, and also move the blob messages to the... (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/render_messages.h ('k') | chrome/common/webblobregistry_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/render_messages.cc
===================================================================
--- chrome/common/render_messages.cc (revision 77977)
+++ chrome/common/render_messages.cc (working copy)
@@ -800,106 +800,6 @@
l->append(")");
}
-// Only the webkit_blob::BlobData ParamTraits<> definition needs this
-// definition, so keep this in the implementation file so we can forward declare
-// BlobData in the header.
-template <>
-struct ParamTraits<webkit_blob::BlobData::Item> {
- typedef webkit_blob::BlobData::Item param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, static_cast<int>(p.type()));
- if (p.type() == webkit_blob::BlobData::TYPE_DATA) {
- WriteParam(m, p.data());
- } else if (p.type() == webkit_blob::BlobData::TYPE_FILE) {
- WriteParam(m, p.file_path());
- WriteParam(m, p.offset());
- WriteParam(m, p.length());
- WriteParam(m, p.expected_modification_time());
- } else {
- WriteParam(m, p.blob_url());
- WriteParam(m, p.offset());
- WriteParam(m, p.length());
- }
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- int type;
- if (!ReadParam(m, iter, &type))
- return false;
- if (type == webkit_blob::BlobData::TYPE_DATA) {
- std::string data;
- if (!ReadParam(m, iter, &data))
- return false;
- r->SetToData(data);
- } else if (type == webkit_blob::BlobData::TYPE_FILE) {
- FilePath file_path;
- uint64 offset, length;
- base::Time expected_modification_time;
- if (!ReadParam(m, iter, &file_path))
- return false;
- if (!ReadParam(m, iter, &offset))
- return false;
- if (!ReadParam(m, iter, &length))
- return false;
- if (!ReadParam(m, iter, &expected_modification_time))
- return false;
- r->SetToFile(file_path, offset, length, expected_modification_time);
- } else {
- DCHECK(type == webkit_blob::BlobData::TYPE_BLOB);
- GURL blob_url;
- uint64 offset, length;
- if (!ReadParam(m, iter, &blob_url))
- return false;
- if (!ReadParam(m, iter, &offset))
- return false;
- if (!ReadParam(m, iter, &length))
- return false;
- r->SetToBlob(blob_url, offset, length);
- }
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<BlobData::Item>");
- }
-};
-
-void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Write(
- Message* m, const param_type& p) {
- WriteParam(m, p.get() != NULL);
- if (p) {
- WriteParam(m, p->items());
- WriteParam(m, p->content_type());
- WriteParam(m, p->content_disposition());
- }
-}
-
-bool ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Read(
- const Message* m, void** iter, param_type* r) {
- bool has_object;
- if (!ReadParam(m, iter, &has_object))
- return false;
- if (!has_object)
- return true;
- std::vector<webkit_blob::BlobData::Item> items;
- if (!ReadParam(m, iter, &items))
- return false;
- std::string content_type;
- if (!ReadParam(m, iter, &content_type))
- return false;
- std::string content_disposition;
- if (!ReadParam(m, iter, &content_disposition))
- return false;
- *r = new webkit_blob::BlobData;
- (*r)->swap_items(&items);
- (*r)->set_content_type(content_type);
- (*r)->set_content_disposition(content_disposition);
- return true;
-}
-
-void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Log(
- const param_type& p, std::string* l) {
- l->append("<webkit_blob::BlobData>");
-}
-
void ParamTraits<AudioBuffersState>::Write(Message* m, const param_type& p) {
WriteParam(m, p.pending_bytes);
WriteParam(m, p.hardware_delay_bytes);
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/common/webblobregistry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698