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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/Iterable.h

Issue 2810743003: Move ScriptState::GetExecutionContext (Part 3) (Closed)
Patch Set: Rebase Created 3 years, 8 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 #ifndef Iterable_h 5 #ifndef Iterable_h
6 #define Iterable_h 6 #define Iterable_h
7 7
8 #include "bindings/core/v8/V8IteratorResultValue.h" 8 #include "bindings/core/v8/V8IteratorResultValue.h"
9 #include "bindings/core/v8/V8ScriptRunner.h" 9 #include "bindings/core/v8/V8ScriptRunner.h"
10 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/Iterator.h" 11 #include "core/dom/Iterator.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 // Typically, you should use PairIterable<> (below) instead. 15 // Typically, you should use PairIterable<> (below) instead.
15 // Also, note that value iterators are set up automatically by the bindings 16 // Also, note that value iterators are set up automatically by the bindings
16 // code and the operations below come directly from V8. 17 // code and the operations below come directly from V8.
17 template <typename KeyType, typename ValueType> 18 template <typename KeyType, typename ValueType>
18 class Iterable { 19 class Iterable {
19 public: 20 public:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 args[0] = ToV8(value, creation_context, isolate); 76 args[0] = ToV8(value, creation_context, isolate);
76 args[1] = ToV8(key, creation_context, isolate); 77 args[1] = ToV8(key, creation_context, isolate);
77 if (args[0].IsEmpty() || args[1].IsEmpty()) { 78 if (args[0].IsEmpty() || args[1].IsEmpty()) {
78 if (try_catch.HasCaught()) 79 if (try_catch.HasCaught())
79 exception_state.RethrowV8Exception(try_catch.Exception()); 80 exception_state.RethrowV8Exception(try_catch.Exception());
80 return; 81 return;
81 } 82 }
82 83
83 v8::Local<v8::Value> result; 84 v8::Local<v8::Value> result;
84 if (!V8ScriptRunner::CallFunction(v8_callback, 85 if (!V8ScriptRunner::CallFunction(v8_callback,
85 script_state->GetExecutionContext(), 86 ExecutionContext::From(script_state),
86 v8_this_arg, 3, args, isolate) 87 v8_this_arg, 3, args, isolate)
87 .ToLocal(&result)) { 88 .ToLocal(&result)) {
88 exception_state.RethrowV8Exception(try_catch.Exception()); 89 exception_state.RethrowV8Exception(try_catch.Exception());
89 return; 90 return;
90 } 91 }
91 } 92 }
92 } 93 }
93 94
94 class IterationSource : public GarbageCollectedFinalized<IterationSource> { 95 class IterationSource : public GarbageCollectedFinalized<IterationSource> {
95 public: 96 public:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 public: 180 public:
180 Iterator* GetIterator(ScriptState* script_state, 181 Iterator* GetIterator(ScriptState* script_state,
181 ExceptionState& exception_state) { 182 ExceptionState& exception_state) {
182 return this->entriesForBinding(script_state, exception_state); 183 return this->entriesForBinding(script_state, exception_state);
183 } 184 }
184 }; 185 };
185 186
186 } // namespace blink 187 } // namespace blink
187 188
188 #endif // Iterable_h 189 #endif // Iterable_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698