| OLD | NEW |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 functionDescriptor = v8::FunctionTemplate::New(); | 66 functionDescriptor = v8::FunctionTemplate::New(); |
| 67 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); | 67 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); |
| 68 instanceTemplate->SetInternalFieldCount(internalFieldCount); | 68 instanceTemplate->SetInternalFieldCount(internalFieldCount); |
| 69 data->setPrivateTemplate(currentWorldType, privateTemplateUniqueKey, functio
nDescriptor); | 69 data->setPrivateTemplate(currentWorldType, privateTemplateUniqueKey, functio
nDescriptor); |
| 70 return instanceTemplate; | 70 return instanceTemplate; |
| 71 } | 71 } |
| 72 | 72 |
| 73 v8::Local<v8::ObjectTemplate> promiseAllEnvironmentObjectTemplate(v8::Isolate* i
solate) | 73 v8::Local<v8::ObjectTemplate> promiseAllEnvironmentObjectTemplate(v8::Isolate* i
solate) |
| 74 { | 74 { |
| 75 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 75 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 76 static int privateTemplateUniqueKey = 0; | 76 static int privateTemplateUniqueKey; |
| 77 return cachedObjectTemplate(&privateTemplateUniqueKey, V8PromiseCustom::Prom
iseAllEnvironmentFieldCount, isolate); | 77 return cachedObjectTemplate(&privateTemplateUniqueKey, V8PromiseCustom::Prom
iseAllEnvironmentFieldCount, isolate); |
| 78 } | 78 } |
| 79 | 79 |
| 80 v8::Local<v8::ObjectTemplate> primitiveWrapperObjectTemplate(v8::Isolate* isolat
e) | 80 v8::Local<v8::ObjectTemplate> primitiveWrapperObjectTemplate(v8::Isolate* isolat
e) |
| 81 { | 81 { |
| 82 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 82 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 83 static int privateTemplateUniqueKey = 0; | 83 static int privateTemplateUniqueKey; |
| 84 return cachedObjectTemplate(&privateTemplateUniqueKey, V8PromiseCustom::Prim
itiveWrapperFieldCount, isolate); | 84 return cachedObjectTemplate(&privateTemplateUniqueKey, V8PromiseCustom::Prim
itiveWrapperFieldCount, isolate); |
| 85 } | 85 } |
| 86 | 86 |
| 87 v8::Local<v8::ObjectTemplate> internalObjectTemplate(v8::Isolate* isolate) | 87 v8::Local<v8::ObjectTemplate> internalObjectTemplate(v8::Isolate* isolate) |
| 88 { | 88 { |
| 89 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 89 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 90 static int privateTemplateUniqueKey = 0; | 90 static int privateTemplateUniqueKey; |
| 91 return cachedObjectTemplate(&privateTemplateUniqueKey, V8PromiseCustom::Inte
rnalFieldCount, isolate); | 91 return cachedObjectTemplate(&privateTemplateUniqueKey, V8PromiseCustom::Inte
rnalFieldCount, isolate); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void promiseResolveCallback(const v8::FunctionCallbackInfo<v8::Value>& args) | 94 void promiseResolveCallback(const v8::FunctionCallbackInfo<v8::Value>& args) |
| 95 { | 95 { |
| 96 ASSERT(!args.Data().IsEmpty()); | 96 ASSERT(!args.Data().IsEmpty()); |
| 97 v8::Local<v8::Object> promise = args.Data().As<v8::Object>(); | 97 v8::Local<v8::Object> promise = args.Data().As<v8::Object>(); |
| 98 v8::Local<v8::Value> result = v8::Undefined(args.GetIsolate()); | 98 v8::Local<v8::Value> result = v8::Undefined(args.GetIsolate()); |
| 99 if (args.Length() > 0) | 99 if (args.Length() > 0) |
| 100 result = args[0]; | 100 result = args[0]; |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 } | 814 } |
| 815 | 815 |
| 816 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8:
:Function> handler, v8::Handle<v8::Value> argument, v8::Isolate* isolate) | 816 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8:
:Function> handler, v8::Handle<v8::Value> argument, v8::Isolate* isolate) |
| 817 { | 817 { |
| 818 ExecutionContext* executionContext = getExecutionContext(); | 818 ExecutionContext* executionContext = getExecutionContext(); |
| 819 ASSERT(executionContext && executionContext->isContextThread()); | 819 ASSERT(executionContext && executionContext->isContextThread()); |
| 820 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar
gument, isolate))); | 820 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar
gument, isolate))); |
| 821 } | 821 } |
| 822 | 822 |
| 823 } // namespace WebCore | 823 } // namespace WebCore |
| OLD | NEW |