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

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

Issue 2755383004: Encapsulate optional SerializedScriptValue serialize/deserialize parameters. (Closed)
Patch Set: fuzzer Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/notifications/NotificationData.h" 5 #include "modules/notifications/NotificationData.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/SerializedScriptValue.h" 8 #include "bindings/core/v8/SerializedScriptValue.h"
9 #include "bindings/core/v8/SerializedScriptValueFactory.h" 9 #include "bindings/core/v8/SerializedScriptValueFactory.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 : WTF::currentTimeMS(); 80 : WTF::currentTimeMS();
81 webData.renotify = options.renotify(); 81 webData.renotify = options.renotify();
82 webData.silent = options.silent(); 82 webData.silent = options.silent();
83 webData.requireInteraction = options.requireInteraction(); 83 webData.requireInteraction = options.requireInteraction();
84 84
85 if (options.hasData()) { 85 if (options.hasData()) {
86 const ScriptValue& data = options.data(); 86 const ScriptValue& data = options.data();
87 v8::Isolate* isolate = data.isolate(); 87 v8::Isolate* isolate = data.isolate();
88 DCHECK(isolate->InContext()); 88 DCHECK(isolate->InContext());
89 RefPtr<SerializedScriptValue> serializedScriptValue = 89 RefPtr<SerializedScriptValue> serializedScriptValue =
90 SerializedScriptValue::serialize(isolate, data.v8Value(), nullptr, 90 SerializedScriptValue::serialize(
91 nullptr, exceptionState); 91 isolate, data.v8Value(), SerializedScriptValue::SerializeOptions(),
92 exceptionState);
92 if (exceptionState.hadException()) 93 if (exceptionState.hadException())
93 return WebNotificationData(); 94 return WebNotificationData();
94 95
95 Vector<char> serializedData; 96 Vector<char> serializedData;
96 serializedScriptValue->toWireBytes(serializedData); 97 serializedScriptValue->toWireBytes(serializedData);
97 98
98 webData.data = serializedData; 99 webData.data = serializedData;
99 } 100 }
100 101
101 Vector<WebNotificationAction> actions; 102 Vector<WebNotificationAction> actions;
(...skipping 28 matching lines...) Expand all
130 131
131 actions.push_back(webAction); 132 actions.push_back(webAction);
132 } 133 }
133 134
134 webData.actions = actions; 135 webData.actions = actions;
135 136
136 return webData; 137 return webData;
137 } 138 }
138 139
139 } // namespace blink 140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698