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

Side by Side Diff: Source/bindings/v8/custom/V8PromiseCustom.cpp

Issue 128973003: Update bindings classes to use OVERRIDE / FINAL when needed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « Source/bindings/v8/custom/V8CustomXPathNSResolver.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 ASSERT(!derivedPromise.IsEmpty()); 185 ASSERT(!derivedPromise.IsEmpty());
186 derivedPromises->Set(derivedPromises->Length(), derivedPromise); 186 derivedPromises->Set(derivedPromises->Length(), derivedPromise);
187 187
188 // Since they are treated as a tuple, 188 // Since they are treated as a tuple,
189 // we need to guaranteed that the length of these arrays are same. 189 // we need to guaranteed that the length of these arrays are same.
190 ASSERT(fulfillCallbacks->Length() == rejectCallbacks->Length() && rejectCall backs->Length() == derivedPromises->Length()); 190 ASSERT(fulfillCallbacks->Length() == rejectCallbacks->Length() && rejectCall backs->Length() == derivedPromises->Length());
191 } 191 }
192 192
193 class CallHandlerTask : public ExecutionContextTask { 193 class CallHandlerTask FINAL : public ExecutionContextTask {
194 public: 194 public:
195 CallHandlerTask(v8::Handle<v8::Object> promise, v8::Handle<v8::Function> han dler, v8::Handle<v8::Value> argument, v8::Isolate* isolate, ExecutionContext* co ntext) 195 CallHandlerTask(v8::Handle<v8::Object> promise, v8::Handle<v8::Function> han dler, v8::Handle<v8::Value> argument, v8::Isolate* isolate, ExecutionContext* co ntext)
196 : m_promise(isolate, promise) 196 : m_promise(isolate, promise)
197 , m_handler(isolate, handler) 197 , m_handler(isolate, handler)
198 , m_argument(isolate, argument) 198 , m_argument(isolate, argument)
199 , m_requestState(context) 199 , m_requestState(context)
200 { 200 {
201 ASSERT(!m_promise.isEmpty()); 201 ASSERT(!m_promise.isEmpty());
202 ASSERT(!m_handler.isEmpty()); 202 ASSERT(!m_handler.isEmpty());
203 ASSERT(!m_argument.isEmpty()); 203 ASSERT(!m_argument.isEmpty());
(...skipping 20 matching lines...) Expand all
224 v8::Handle<v8::Value> info[] = { m_argument.newLocal(isolate) }; 224 v8::Handle<v8::Value> info[] = { m_argument.newLocal(isolate) };
225 v8::TryCatch trycatch; 225 v8::TryCatch trycatch;
226 v8::Local<v8::Value> value = V8ScriptRunner::callFunction(m_handler.newLocal (isolate), context, v8::Undefined(isolate), WTF_ARRAY_LENGTH(info), info, isolat e); 226 v8::Local<v8::Value> value = V8ScriptRunner::callFunction(m_handler.newLocal (isolate), context, v8::Undefined(isolate), WTF_ARRAY_LENGTH(info), info, isolat e);
227 if (value.IsEmpty()) { 227 if (value.IsEmpty()) {
228 V8PromiseCustom::reject(m_promise.newLocal(isolate), trycatch.Exception( ), isolate); 228 V8PromiseCustom::reject(m_promise.newLocal(isolate), trycatch.Exception( ), isolate);
229 } else { 229 } else {
230 V8PromiseCustom::resolve(m_promise.newLocal(isolate), value, isolate); 230 V8PromiseCustom::resolve(m_promise.newLocal(isolate), value, isolate);
231 } 231 }
232 } 232 }
233 233
234 class UpdateDerivedTask : public ExecutionContextTask { 234 class UpdateDerivedTask FINAL : public ExecutionContextTask {
235 public: 235 public:
236 UpdateDerivedTask(v8::Handle<v8::Object> promise, v8::Handle<v8::Function> o nFulfilled, v8::Handle<v8::Function> onRejected, v8::Handle<v8::Object> originat orValueObject, v8::Isolate* isolate, ExecutionContext* context) 236 UpdateDerivedTask(v8::Handle<v8::Object> promise, v8::Handle<v8::Function> o nFulfilled, v8::Handle<v8::Function> onRejected, v8::Handle<v8::Object> originat orValueObject, v8::Isolate* isolate, ExecutionContext* context)
237 : m_promise(isolate, promise) 237 : m_promise(isolate, promise)
238 , m_onFulfilled(isolate, onFulfilled) 238 , m_onFulfilled(isolate, onFulfilled)
239 , m_onRejected(isolate, onRejected) 239 , m_onRejected(isolate, onRejected)
240 , m_originatorValueObject(isolate, originatorValueObject) 240 , m_originatorValueObject(isolate, originatorValueObject)
241 , m_requestState(context) 241 , m_requestState(context)
242 { 242 {
243 ASSERT(!m_promise.isEmpty()); 243 ASSERT(!m_promise.isEmpty());
244 ASSERT(!m_originatorValueObject.isEmpty()); 244 ASSERT(!m_originatorValueObject.isEmpty());
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 784 }
785 785
786 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8: :Function> handler, v8::Handle<v8::Value> argument, v8::Isolate* isolate) 786 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8: :Function> handler, v8::Handle<v8::Value> argument, v8::Isolate* isolate)
787 { 787 {
788 ExecutionContext* executionContext = getExecutionContext(); 788 ExecutionContext* executionContext = getExecutionContext();
789 ASSERT(executionContext && executionContext->isContextThread()); 789 ASSERT(executionContext && executionContext->isContextThread());
790 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar gument, isolate, executionContext))); 790 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar gument, isolate, executionContext)));
791 } 791 }
792 792
793 } // namespace WebCore 793 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8CustomXPathNSResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698