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

Side by Side Diff: chrome/common/ipc_message_utils.cc

Issue 94006: Merge r14408. (Closed) Base URL: svn://chrome-svn/chrome/branches/release_154.next/src/
Patch Set: Created 11 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/ipc_message_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/ipc_message_utils.h" 5 #include "chrome/common/ipc_message_utils.h"
6 6
7 #include "base/gfx/rect.h" 7 #include "base/gfx/rect.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "webkit/glue/dom_operations.h" 10 #include "webkit/glue/dom_operations.h"
(...skipping 16 matching lines...) Expand all
27 // The number of bytes between subsequent rows of the bitmap. 27 // The number of bytes between subsequent rows of the bitmap.
28 uint32 fRowBytes; 28 uint32 fRowBytes;
29 29
30 void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) { 30 void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) {
31 fConfig = bitmap.config(); 31 fConfig = bitmap.config();
32 fWidth = bitmap.width(); 32 fWidth = bitmap.width();
33 fHeight = bitmap.height(); 33 fHeight = bitmap.height();
34 fRowBytes = bitmap.rowBytes(); 34 fRowBytes = bitmap.rowBytes();
35 } 35 }
36 36
37 void InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels, 37 // Returns whether |bitmap| successfully initialized.
38 bool InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels,
38 size_t total_pixels) const { 39 size_t total_pixels) const {
39 if (total_pixels) { 40 if (total_pixels) {
40 bitmap->setConfig(fConfig, fWidth, fHeight, fRowBytes); 41 bitmap->setConfig(fConfig, fWidth, fHeight, fRowBytes);
41 bitmap->allocPixels(); 42 if (!bitmap->allocPixels())
43 return false;
44 if (total_pixels > bitmap->getSize())
45 return false;
42 memcpy(bitmap->getPixels(), pixels, total_pixels); 46 memcpy(bitmap->getPixels(), pixels, total_pixels);
43 } 47 }
48 return true;
44 } 49 }
45 }; 50 };
46 51
47 struct WebCursor_Data { 52 struct WebCursor_Data {
48 WebCursor::Type cursor_type; 53 WebCursor::Type cursor_type;
49 int hotspot_x; 54 int hotspot_x;
50 int hotspot_y; 55 int hotspot_y;
51 SkBitmap_Data bitmap_info; 56 SkBitmap_Data bitmap_info;
52 }; 57 };
53 58
(...skipping 25 matching lines...) Expand all
79 84
80 const char* variable_data; 85 const char* variable_data;
81 int variable_data_size = 0; 86 int variable_data_size = 0;
82 if (!m->ReadData(iter, &variable_data, &variable_data_size) || 87 if (!m->ReadData(iter, &variable_data, &variable_data_size) ||
83 (variable_data_size < 0)) { 88 (variable_data_size < 0)) {
84 NOTREACHED(); 89 NOTREACHED();
85 return false; 90 return false;
86 } 91 }
87 const SkBitmap_Data* bmp_data = 92 const SkBitmap_Data* bmp_data =
88 reinterpret_cast<const SkBitmap_Data*>(fixed_data); 93 reinterpret_cast<const SkBitmap_Data*>(fixed_data);
89 bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); 94 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size);
90 return true;
91 } 95 }
92 96
93 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::wstring* l) { 97 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::wstring* l) {
94 l->append(StringPrintf(L"<SkBitmap>")); 98 l->append(StringPrintf(L"<SkBitmap>"));
95 } 99 }
96 100
97 101
98 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { 102 void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
99 m->WriteString(p.possibly_invalid_spec()); 103 m->WriteString(p.possibly_invalid_spec());
100 // TODO(brettw) bug 684583: Add encoding for query params. 104 // TODO(brettw) bug 684583: Add encoding for query params.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return result; 287 return result;
284 } 288 }
285 289
286 void ParamTraits<webkit_glue::WebApplicationInfo>::Log( 290 void ParamTraits<webkit_glue::WebApplicationInfo>::Log(
287 const webkit_glue::WebApplicationInfo& p, std::wstring* l) { 291 const webkit_glue::WebApplicationInfo& p, std::wstring* l) {
288 l->append(L"<WebApplicationInfo>"); 292 l->append(L"<WebApplicationInfo>");
289 } 293 }
290 294
291 } // namespace IPC 295 } // namespace IPC
292 296
OLDNEW
« no previous file with comments | « chrome/common/ipc_message_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698