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

Side by Side Diff: webkit/api/public/WebInputEvent.h

Issue 235038: Fix an uninitialized memory error reported by valgrind.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 WebUChar unmodifiedText[textLengthCap]; 165 WebUChar unmodifiedText[textLengthCap];
166 166
167 // This is a string identifying the key pressed. 167 // This is a string identifying the key pressed.
168 char keyIdentifier[keyIdentifierLengthCap]; 168 char keyIdentifier[keyIdentifierLengthCap];
169 169
170 // This identifies whether this event was tagged by the system as being 170 // This identifies whether this event was tagged by the system as being
171 // a "system key" event (see 171 // a "system key" event (see
172 // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for 172 // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
173 // details). Other platforms don't have this concept, but it's just 173 // details). Other platforms don't have this concept, but it's just
174 // easier to leave it always false than ifdef. 174 // easier to leave it always false than ifdef.
175 bool isSystemKey; 175 // int is used instead of bool to ensure the size of this structure is
176 // strictly aligned to a factor of 4 bytes, otherwise memory check tools
177 // like valgrind may complain about uninitialized memory usage when
178 // transfering it over the wire.
179 int isSystemKey;
176 180
177 WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent)) 181 WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent))
178 : WebInputEvent(sizeParam) 182 : WebInputEvent(sizeParam)
179 , windowsKeyCode(0) 183 , windowsKeyCode(0)
180 , nativeKeyCode(0) 184 , nativeKeyCode(0)
181 , isSystemKey(false) 185 , isSystemKey(false)
182 { 186 {
183 memset(&text, 0, sizeof(text)); 187 memset(&text, 0, sizeof(text));
184 memset(&unmodifiedText, 0, sizeof(unmodifiedText)); 188 memset(&unmodifiedText, 0, sizeof(unmodifiedText));
185 memset(&keyIdentifier, 0, sizeof(keyIdentifier)); 189 memset(&keyIdentifier, 0, sizeof(keyIdentifier));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 }; 230 };
227 231
228 // WebMouseWheelEvent --------------------------------------------------------- 232 // WebMouseWheelEvent ---------------------------------------------------------
229 233
230 class WebMouseWheelEvent : public WebMouseEvent { 234 class WebMouseWheelEvent : public WebMouseEvent {
231 public: 235 public:
232 float deltaX; 236 float deltaX;
233 float deltaY; 237 float deltaY;
234 float wheelTicksX; 238 float wheelTicksX;
235 float wheelTicksY; 239 float wheelTicksY;
236 bool scrollByPage; 240
241 // int is used instead of bool to ensure the size of this structure is
242 // strictly aligned to a factor of 4 bytes, otherwise memory check tools
243 // like valgrind may complain about uninitialized memory usage when
244 // transfering it over the wire.
245 int scrollByPage;
237 246
238 WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent)) 247 WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent))
239 : WebMouseEvent(sizeParam) 248 : WebMouseEvent(sizeParam)
240 , deltaX(0.0f) 249 , deltaX(0.0f)
241 , deltaY(0.0f) 250 , deltaY(0.0f)
242 , wheelTicksX(0.0f) 251 , wheelTicksX(0.0f)
243 , wheelTicksY(0.0f) 252 , wheelTicksY(0.0f)
244 , scrollByPage(false) 253 , scrollByPage(false)
245 { 254 {
246 } 255 }
247 }; 256 };
248 257
249 } // namespace WebKit 258 } // namespace WebKit
250 259
251 #endif 260 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698