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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/Notification.cpp

Issue 2106843005: Use SaveSameObject for Notification.data as well (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-action-vibrate
Patch Set: Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return m_data.silent; 287 return m_data.silent;
288 } 288 }
289 289
290 bool Notification::requireInteraction() const 290 bool Notification::requireInteraction() const
291 { 291 {
292 return m_data.requireInteraction; 292 return m_data.requireInteraction;
293 } 293 }
294 294
295 ScriptValue Notification::data(ScriptState* scriptState) 295 ScriptValue Notification::data(ScriptState* scriptState)
296 { 296 {
297 if (m_developerData.isEmpty()) { 297 const WebVector<char>& serializedData = m_data.data;
298 const WebVector<char>& serializedData = m_data.data; 298 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::creat e(serializedData.data(), serializedData.size());
299 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::c reate(serializedData.data(), serializedData.size());
300 m_developerData = ScriptValue(scriptState, serializedValue->deserialize( scriptState->isolate()));
301 }
302 299
303 return m_developerData; 300 return ScriptValue(scriptState, serializedValue->deserialize(scriptState->is olate()));
304 } 301 }
305 302
306 Vector<v8::Local<v8::Value>> Notification::actions(ScriptState* scriptState) con st 303 Vector<v8::Local<v8::Value>> Notification::actions(ScriptState* scriptState) con st
307 { 304 {
308 Vector<v8::Local<v8::Value>> actions; 305 Vector<v8::Local<v8::Value>> actions;
309 actions.grow(m_data.actions.size()); 306 actions.grow(m_data.actions.size());
310 307
311 for (size_t i = 0; i < m_data.actions.size(); ++i) { 308 for (size_t i = 0; i < m_data.actions.size(); ++i) {
312 NotificationAction action; 309 NotificationAction action;
313 310
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 399
403 DEFINE_TRACE(Notification) 400 DEFINE_TRACE(Notification)
404 { 401 {
405 visitor->trace(m_prepareShowMethodRunner); 402 visitor->trace(m_prepareShowMethodRunner);
406 visitor->trace(m_loader); 403 visitor->trace(m_loader);
407 EventTargetWithInlineData::trace(visitor); 404 EventTargetWithInlineData::trace(visitor);
408 ActiveDOMObject::trace(visitor); 405 ActiveDOMObject::trace(visitor);
409 } 406 }
410 407
411 } // namespace blink 408 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698