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

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

Issue 18452009: Move createClosure from V8PromiseCustom.cpp to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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/V8Binding.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/page/DOMWindow.h" 44 #include "core/page/DOMWindow.h"
45 #include "core/platform/Task.h" 45 #include "core/platform/Task.h"
46 #include "wtf/Functional.h" 46 #include "wtf/Functional.h"
47 #include "wtf/PassOwnPtr.h" 47 #include "wtf/PassOwnPtr.h"
48 #include <v8.h> 48 #include <v8.h>
49 49
50 namespace WebCore { 50 namespace WebCore {
51 51
52 namespace { 52 namespace {
53 53
54 v8::Local<v8::Function> createClosure(v8::FunctionCallback function, v8::Handle< v8::Value> environment)
55 {
56 return v8::FunctionTemplate::New(function, environment)->GetFunction();
57 }
58
59 class PromiseTask : public ScriptExecutionContext::Task { 54 class PromiseTask : public ScriptExecutionContext::Task {
60 public: 55 public:
61 PromiseTask(v8::Handle<v8::Function> callback, v8::Handle<v8::Object> receiv er, v8::Handle<v8::Value> result) 56 PromiseTask(v8::Handle<v8::Function> callback, v8::Handle<v8::Object> receiv er, v8::Handle<v8::Value> result)
62 : m_callback(callback) 57 : m_callback(callback)
63 , m_receiver(receiver) 58 , m_receiver(receiver)
64 , m_result(result) 59 , m_result(result)
65 { 60 {
66 ASSERT(!m_callback.isEmpty()); 61 ASSERT(!m_callback.isEmpty());
67 ASSERT(!m_receiver.isEmpty()); 62 ASSERT(!m_receiver.isEmpty());
68 ASSERT(!m_result.isEmpty()); 63 ASSERT(!m_result.isEmpty());
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 v8::TryCatch trycatch; 598 v8::TryCatch trycatch;
604 v8::Handle<v8::Value> args[] = { result }; 599 v8::Handle<v8::Value> args[] = { result };
605 V8ScriptRunner::callFunction(function, getScriptExecutionContext(), rece iver, WTF_ARRAY_LENGTH(args), args); 600 V8ScriptRunner::callFunction(function, getScriptExecutionContext(), rece iver, WTF_ARRAY_LENGTH(args), args);
606 } else { 601 } else {
607 ASSERT(mode == Asynchronous); 602 ASSERT(mode == Asynchronous);
608 postTask(function, receiver, result, isolate); 603 postTask(function, receiver, result, isolate);
609 } 604 }
610 } 605 }
611 606
612 } // namespace WebCore 607 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698