diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 00:21:47 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 00:21:47 +0000 |
commit | db10d8fe8c04b6026bd9e27723694e496c763893 (patch) | |
tree | 20c62ab9c05f239ec32446cb2876affd9a9aa6e7 /chrome/common/render_messages.cc | |
parent | b2d79d2f07f43899f8ece7dd9753c2955b685dd8 (diff) | |
download | chromium_src-db10d8fe8c04b6026bd9e27723694e496c763893.zip chromium_src-db10d8fe8c04b6026bd9e27723694e496c763893.tar.gz chromium_src-db10d8fe8c04b6026bd9e27723694e496c763893.tar.bz2 |
Move the blob related code to content, and also move the blob messages to their own file.
TBR=jianli
Review URL: http://codereview.chromium.org/6681028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.cc')
-rw-r--r-- | chrome/common/render_messages.cc | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index f6ec771..851bf39 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -800,106 +800,6 @@ void ParamTraits<webkit_glue::WebAccessibility>::Log(const param_type& p, 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); |