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

Unified Diff: chrome/common/common_param_traits.cc

Issue 6705012: Move the rest of the content browser->renderer messages to content. Also move drag related messa... (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/common_param_traits.h ('k') | chrome/common/extensions/extension_unpacker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/common_param_traits.cc
===================================================================
--- chrome/common/common_param_traits.cc (revision 79031)
+++ chrome/common/common_param_traits.cc (working copy)
@@ -14,93 +14,10 @@
#include "printing/backend/print_backend.h"
#include "printing/native_metafile.h"
#include "printing/page_range.h"
-
-#ifndef EXCLUDE_SKIA_DEPENDENCIES
-#include "third_party/skia/include/core/SkBitmap.h"
-#endif
#include "webkit/glue/password_form.h"
namespace IPC {
-#ifndef EXCLUDE_SKIA_DEPENDENCIES
-
-namespace {
-
-struct SkBitmap_Data {
- // The configuration for the bitmap (bits per pixel, etc).
- SkBitmap::Config fConfig;
-
- // The width of the bitmap in pixels.
- uint32 fWidth;
-
- // The height of the bitmap in pixels.
- uint32 fHeight;
-
- void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) {
- fConfig = bitmap.config();
- fWidth = bitmap.width();
- fHeight = bitmap.height();
- }
-
- // Returns whether |bitmap| successfully initialized.
- bool InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels,
- size_t total_pixels) const {
- if (total_pixels) {
- bitmap->setConfig(fConfig, fWidth, fHeight, 0);
- if (!bitmap->allocPixels())
- return false;
- if (total_pixels != bitmap->getSize())
- return false;
- memcpy(bitmap->getPixels(), pixels, total_pixels);
- }
- return true;
- }
-};
-
-} // namespace
-
-
-void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) {
- size_t fixed_size = sizeof(SkBitmap_Data);
- SkBitmap_Data bmp_data;
- bmp_data.InitSkBitmapDataForTransfer(p);
- m->WriteData(reinterpret_cast<const char*>(&bmp_data),
- static_cast<int>(fixed_size));
- size_t pixel_size = p.getSize();
- SkAutoLockPixels p_lock(p);
- m->WriteData(reinterpret_cast<const char*>(p.getPixels()),
- static_cast<int>(pixel_size));
-}
-
-bool ParamTraits<SkBitmap>::Read(const Message* m, void** iter, SkBitmap* r) {
- const char* fixed_data;
- int fixed_data_size = 0;
- if (!m->ReadData(iter, &fixed_data, &fixed_data_size) ||
- (fixed_data_size <= 0)) {
- NOTREACHED();
- return false;
- }
- if (fixed_data_size != sizeof(SkBitmap_Data))
- return false; // Message is malformed.
-
- const char* variable_data;
- int variable_data_size = 0;
- if (!m->ReadData(iter, &variable_data, &variable_data_size) ||
- (variable_data_size < 0)) {
- NOTREACHED();
- return false;
- }
- const SkBitmap_Data* bmp_data =
- reinterpret_cast<const SkBitmap_Data*>(fixed_data);
- return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size);
-}
-
-void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) {
- l->append("<SkBitmap>");
-}
-
-#endif // EXCLUDE_SKIA_DEPENDENCIES
-
void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p));
}
« no previous file with comments | « chrome/common/common_param_traits.h ('k') | chrome/common/extensions/extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698