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

Side by Side Diff: Source/bindings/v8/V8Binding.cpp

Issue 339063003: Add invokeCallback functionality to the code generator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 { 112 {
113 throwTypeError(ExceptionMessages::failedToConstruct(type, ExceptionMessages: :notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate); 113 throwTypeError(ExceptionMessages::failedToConstruct(type, ExceptionMessages: :notEnoughArguments(expected, providedLeastNumMandatoryParams)), isolate);
114 } 114 }
115 115
116 void throwMinimumArityTypeError(ExceptionState& exceptionState, unsigned expecte d, unsigned providedLeastNumMandatoryParams) 116 void throwMinimumArityTypeError(ExceptionState& exceptionState, unsigned expecte d, unsigned providedLeastNumMandatoryParams)
117 { 117 {
118 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , providedLeastNumMandatoryParams)); 118 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , providedLeastNumMandatoryParams));
119 exceptionState.throwIfNeeded(); 119 exceptionState.throwIfNeeded();
120 } 120 }
121 121
122 bool invokeCallback(ScriptState* scriptState, v8::Local<v8::Function> callback, int argc, v8::Handle<v8::Value> argv[])
123 {
124 return invokeCallback(scriptState, callback, scriptState->context()->Global( ), argc, argv);
125 }
126
127 bool invokeCallback(ScriptState* scriptState, v8::Local<v8::Function> callback, v8::Handle<v8::Value> thisValue, int argc, v8::Handle<v8::Value> argv[])
128 {
129 v8::TryCatch exceptionCatcher;
130 exceptionCatcher.SetVerbose(true);
131 ScriptController::callFunction(scriptState->executionContext(), callback, th isValue, argc, argv, scriptState->isolate());
132 return !exceptionCatcher.HasCaught();
133 }
134
135 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 122 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
136 virtual void* Allocate(size_t size) OVERRIDE 123 virtual void* Allocate(size_t size) OVERRIDE
137 { 124 {
138 void* data; 125 void* data;
139 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data); 126 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data);
140 return data; 127 return data;
141 } 128 }
142 129
143 virtual void* AllocateUninitialized(size_t size) OVERRIDE 130 virtual void* AllocateUninitialized(size_t size) OVERRIDE
144 { 131 {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) 931 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
945 { 932 {
946 int scriptId = 0; 933 int scriptId = 0;
947 String resourceName; 934 String resourceName;
948 int lineNumber = 1; 935 int lineNumber = 1;
949 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r); 936 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r);
950 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber); 937 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber);
951 } 938 }
952 939
953 } // namespace WebCore 940 } // 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