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

Side by Side Diff: Source/bindings/core/v8/ScriptPromisePropertyTest.cpp

Issue 1111163003: Replace v8::Handle<> with v8::Local<> in bindings/core/v8/* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/ScriptPromiseProperty.h" 6 #include "bindings/core/v8/ScriptPromiseProperty.h"
7 7
8 #include "bindings/core/v8/DOMWrapperWorld.h" 8 #include "bindings/core/v8/DOMWrapperWorld.h"
9 #include "bindings/core/v8/ScriptFunction.h" 9 #include "bindings/core/v8/ScriptFunction.h"
10 #include "bindings/core/v8/ScriptPromise.h" 10 #include "bindings/core/v8/ScriptPromise.h"
(...skipping 14 matching lines...) Expand all
25 #include "wtf/RefPtr.h" 25 #include "wtf/RefPtr.h"
26 #include <gtest/gtest.h> 26 #include <gtest/gtest.h>
27 #include <v8.h> 27 #include <v8.h>
28 28
29 using namespace blink; 29 using namespace blink;
30 30
31 namespace { 31 namespace {
32 32
33 class NotReached : public ScriptFunction { 33 class NotReached : public ScriptFunction {
34 public: 34 public:
35 static v8::Handle<v8::Function> createFunction(ScriptState* scriptState) 35 static v8::Local<v8::Function> createFunction(ScriptState* scriptState)
36 { 36 {
37 NotReached* self = new NotReached(scriptState); 37 NotReached* self = new NotReached(scriptState);
38 return self->bindToV8Function(); 38 return self->bindToV8Function();
39 } 39 }
40 40
41 private: 41 private:
42 explicit NotReached(ScriptState* scriptState) 42 explicit NotReached(ScriptState* scriptState)
43 : ScriptFunction(scriptState) 43 : ScriptFunction(scriptState)
44 { 44 {
45 } 45 }
46 46
47 virtual ScriptValue call(ScriptValue) override; 47 virtual ScriptValue call(ScriptValue) override;
48 }; 48 };
49 49
50 ScriptValue NotReached::call(ScriptValue) 50 ScriptValue NotReached::call(ScriptValue)
51 { 51 {
52 EXPECT_TRUE(false) << "'Unreachable' code was reached"; 52 EXPECT_TRUE(false) << "'Unreachable' code was reached";
53 return ScriptValue(); 53 return ScriptValue();
54 } 54 }
55 55
56 class StubFunction : public ScriptFunction { 56 class StubFunction : public ScriptFunction {
57 public: 57 public:
58 static v8::Handle<v8::Function> createFunction(ScriptState* scriptState, Scr iptValue& value, size_t& callCount) 58 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, Scri ptValue& value, size_t& callCount)
59 { 59 {
60 StubFunction* self = new StubFunction(scriptState, value, callCount); 60 StubFunction* self = new StubFunction(scriptState, value, callCount);
61 return self->bindToV8Function(); 61 return self->bindToV8Function();
62 } 62 }
63 63
64 private: 64 private:
65 StubFunction(ScriptState* scriptState, ScriptValue& value, size_t& callCount ) 65 StubFunction(ScriptState* scriptState, ScriptValue& value, size_t& callCount )
66 : ScriptFunction(scriptState) 66 : ScriptFunction(scriptState)
67 , m_value(value) 67 , m_value(value)
68 , m_callCount(callCount) 68 , m_callCount(callCount)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 virtual void destroyContext() 147 virtual void destroyContext()
148 { 148 {
149 m_page.clear(); 149 m_page.clear();
150 m_otherScriptState.clear(); 150 m_otherScriptState.clear();
151 gc(); 151 gc();
152 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi thSweep, Heap::ForcedGC); 152 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi thSweep, Heap::ForcedGC);
153 } 153 }
154 154
155 void gc() { V8GCController::collectGarbage(v8::Isolate::GetCurrent()); } 155 void gc() { V8GCController::collectGarbage(v8::Isolate::GetCurrent()); }
156 156
157 v8::Handle<v8::Function> notReached(ScriptState* scriptState) { return NotRe ached::createFunction(scriptState); } 157 v8::Local<v8::Function> notReached(ScriptState* scriptState) { return NotRea ched::createFunction(scriptState); }
158 v8::Handle<v8::Function> stub(ScriptState* scriptState, ScriptValue& value, size_t& callCount) { return StubFunction::createFunction(scriptState, value, cal lCount); } 158 v8::Local<v8::Function> stub(ScriptState* scriptState, ScriptValue& value, s ize_t& callCount) { return StubFunction::createFunction(scriptState, value, call Count); }
159 159
160 template <typename T> 160 template <typename T>
161 ScriptValue wrap(DOMWrapperWorld& world, const T& value) 161 ScriptValue wrap(DOMWrapperWorld& world, const T& value)
162 { 162 {
163 v8::HandleScope handleScope(isolate()); 163 v8::HandleScope handleScope(isolate());
164 ScriptState* scriptState = ScriptState::from(toV8Context(&document(), wo rld)); 164 ScriptState* scriptState = ScriptState::from(toV8Context(&document(), wo rld));
165 ScriptState::Scope scope(scriptState); 165 ScriptState::Scope scope(scriptState);
166 return ScriptValue(scriptState, toV8(value, scriptState->context()->Glob al(), isolate())); 166 return ScriptValue(scriptState, toV8(value, scriptState->context()->Glob al(), isolate()));
167 } 167 }
168 168
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 { 546 {
547 test(String("hello"), "hello", __FILE__, __LINE__); 547 test(String("hello"), "hello", __FILE__, __LINE__);
548 } 548 }
549 549
550 TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithI nteger) 550 TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithI nteger)
551 { 551 {
552 test(-1, "-1", __FILE__, __LINE__); 552 test(-1, "-1", __FILE__, __LINE__);
553 } 553 }
554 554
555 } // namespace 555 } // namespace
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptPromisePropertyBase.cpp ('k') | Source/bindings/core/v8/ScriptPromiseResolverTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698