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

Side by Side Diff: content/common/cursors/webcursor.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « content/common/content_param_traits.cc ('k') | content/common/font_config_ipc_linux.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/cursors/webcursor.h" 5 #include "content/common/cursors/webcursor.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "third_party/WebKit/public/platform/WebImage.h" 9 #include "third_party/WebKit/public/platform/WebImage.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 cursor_info->type = static_cast<WebCursorInfo::Type>(type_); 73 cursor_info->type = static_cast<WebCursorInfo::Type>(type_);
74 cursor_info->hotspot = hotspot_; 74 cursor_info->hotspot = hotspot_;
75 ImageFromCustomData(&cursor_info->custom_image); 75 ImageFromCustomData(&cursor_info->custom_image);
76 cursor_info->image_scale_factor = custom_scale_; 76 cursor_info->image_scale_factor = custom_scale_;
77 77
78 #if defined(OS_WIN) 78 #if defined(OS_WIN)
79 cursor_info->external_handle = external_cursor_; 79 cursor_info->external_handle = external_cursor_;
80 #endif 80 #endif
81 } 81 }
82 82
83 bool WebCursor::Deserialize(PickleIterator* iter) { 83 bool WebCursor::Deserialize(base::PickleIterator* iter) {
84 int type, hotspot_x, hotspot_y, size_x, size_y, data_len; 84 int type, hotspot_x, hotspot_y, size_x, size_y, data_len;
85 float scale; 85 float scale;
86 const char* data; 86 const char* data;
87 87
88 // Leave |this| unmodified unless we are going to return success. 88 // Leave |this| unmodified unless we are going to return success.
89 if (!iter->ReadInt(&type) || 89 if (!iter->ReadInt(&type) ||
90 !iter->ReadInt(&hotspot_x) || 90 !iter->ReadInt(&hotspot_x) ||
91 !iter->ReadInt(&hotspot_y) || 91 !iter->ReadInt(&hotspot_y) ||
92 !iter->ReadLength(&size_x) || 92 !iter->ReadLength(&size_x) ||
93 !iter->ReadLength(&size_y) || 93 !iter->ReadLength(&size_y) ||
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 custom_data_.clear(); 125 custom_data_.clear();
126 if (data_len > 0) { 126 if (data_len > 0) {
127 custom_data_.resize(data_len); 127 custom_data_.resize(data_len);
128 memcpy(&custom_data_[0], data, data_len); 128 memcpy(&custom_data_[0], data, data_len);
129 } 129 }
130 } 130 }
131 } 131 }
132 return DeserializePlatformData(iter); 132 return DeserializePlatformData(iter);
133 } 133 }
134 134
135 bool WebCursor::Serialize(Pickle* pickle) const { 135 bool WebCursor::Serialize(base::Pickle* pickle) const {
136 if (!pickle->WriteInt(type_) || 136 if (!pickle->WriteInt(type_) ||
137 !pickle->WriteInt(hotspot_.x()) || 137 !pickle->WriteInt(hotspot_.x()) ||
138 !pickle->WriteInt(hotspot_.y()) || 138 !pickle->WriteInt(hotspot_.y()) ||
139 !pickle->WriteInt(custom_size_.width()) || 139 !pickle->WriteInt(custom_size_.width()) ||
140 !pickle->WriteInt(custom_size_.height()) || 140 !pickle->WriteInt(custom_size_.height()) ||
141 !pickle->WriteFloat(custom_scale_)) 141 !pickle->WriteFloat(custom_scale_))
142 return false; 142 return false;
143 143
144 const char* data = NULL; 144 const char* data = NULL;
145 if (!custom_data_.empty()) 145 if (!custom_data_.empty())
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return; 253 return;
254 254
255 // Clamp the hotspot to the custom image's dimensions. 255 // Clamp the hotspot to the custom image's dimensions.
256 hotspot_.set_x(std::max(0, 256 hotspot_.set_x(std::max(0,
257 std::min(custom_size_.width() - 1, hotspot_.x()))); 257 std::min(custom_size_.width() - 1, hotspot_.x())));
258 hotspot_.set_y(std::max(0, 258 hotspot_.set_y(std::max(0,
259 std::min(custom_size_.height() - 1, hotspot_.y()))); 259 std::min(custom_size_.height() - 1, hotspot_.y())));
260 } 260 }
261 261
262 } // namespace content 262 } // namespace content
OLDNEW
« no previous file with comments | « content/common/content_param_traits.cc ('k') | content/common/font_config_ipc_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698