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

Side by Side Diff: third_party/WebKit/Source/core/streams/ReadableStreamController.h

Issue 2595543003: Rename toV8(...) function in Blink to ToV8(...). (Closed)
Patch Set: Rebasing... Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef ReadableStreamController_h 5 #ifndef ReadableStreamController_h
6 #define ReadableStreamController_h 6 #define ReadableStreamController_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h" 8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "bindings/core/v8/ScriptValue.h" 9 #include "bindings/core/v8/ScriptValue.h"
10 #include "bindings/core/v8/ToV8.h" 10 #include "bindings/core/v8/ToV8.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ScriptState* scriptState = m_scriptState.get(); 77 ScriptState* scriptState = m_scriptState.get();
78 // This will assert that the context is valid; do not call this method when 78 // This will assert that the context is valid; do not call this method when
79 // the context is invalidated. 79 // the context is invalidated.
80 ScriptState::Scope scope(scriptState); 80 ScriptState::Scope scope(scriptState);
81 v8::Isolate* isolate = scriptState->isolate(); 81 v8::Isolate* isolate = scriptState->isolate();
82 82
83 v8::Local<v8::Value> controller = m_jsController.newLocal(isolate); 83 v8::Local<v8::Value> controller = m_jsController.newLocal(isolate);
84 if (controller.IsEmpty()) 84 if (controller.IsEmpty())
85 return; 85 return;
86 86
87 v8::Local<v8::Value> jsChunk = toV8(chunk, scriptState); 87 v8::Local<v8::Value> jsChunk = ToV8(chunk, scriptState);
88 v8::Local<v8::Value> args[] = {controller, jsChunk}; 88 v8::Local<v8::Value> args[] = {controller, jsChunk};
89 v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra( 89 v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra(
90 scriptState, "ReadableStreamDefaultControllerEnqueue", args); 90 scriptState, "ReadableStreamDefaultControllerEnqueue", args);
91 result.ToLocalChecked(); 91 result.ToLocalChecked();
92 } 92 }
93 93
94 template <typename ErrorType> 94 template <typename ErrorType>
95 void error(ErrorType error) { 95 void error(ErrorType error) {
96 ScriptState* scriptState = m_scriptState.get(); 96 ScriptState* scriptState = m_scriptState.get();
97 // This will assert that the context is valid; do not call this method when 97 // This will assert that the context is valid; do not call this method when
98 // the context is invalidated. 98 // the context is invalidated.
99 ScriptState::Scope scope(scriptState); 99 ScriptState::Scope scope(scriptState);
100 v8::Isolate* isolate = scriptState->isolate(); 100 v8::Isolate* isolate = scriptState->isolate();
101 101
102 v8::Local<v8::Value> controller = m_jsController.newLocal(isolate); 102 v8::Local<v8::Value> controller = m_jsController.newLocal(isolate);
103 if (controller.IsEmpty()) 103 if (controller.IsEmpty())
104 return; 104 return;
105 105
106 v8::Local<v8::Value> jsError = toV8(error, scriptState); 106 v8::Local<v8::Value> jsError = ToV8(error, scriptState);
107 v8::Local<v8::Value> args[] = {controller, jsError}; 107 v8::Local<v8::Value> args[] = {controller, jsError};
108 v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra( 108 v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra(
109 scriptState, "ReadableStreamDefaultControllerError", args); 109 scriptState, "ReadableStreamDefaultControllerError", args);
110 m_jsController.clear(); 110 m_jsController.clear();
111 result.ToLocalChecked(); 111 result.ToLocalChecked();
112 } 112 }
113 113
114 private: 114 private:
115 RefPtr<ScriptState> m_scriptState; 115 RefPtr<ScriptState> m_scriptState;
116 ScopedPersistent<v8::Value> m_jsController; 116 ScopedPersistent<v8::Value> m_jsController;
117 }; 117 };
118 118
119 } // namespace blink 119 } // namespace blink
120 120
121 #endif // ReadableStreamController_h 121 #endif // ReadableStreamController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698