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

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

Issue 348303002: Move invodeCallback from V8Callback to V8Binding (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') | Source/bindings/v8/V8Callback.h » ('j') | 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
122 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 135 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
123 virtual void* Allocate(size_t size) OVERRIDE 136 virtual void* Allocate(size_t size) OVERRIDE
124 { 137 {
125 void* data; 138 void* data;
126 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data); 139 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :ZeroInitialize, data);
127 return data; 140 return data;
128 } 141 }
129 142
130 virtual void* AllocateUninitialized(size_t size) OVERRIDE 143 virtual void* AllocateUninitialized(size_t size) OVERRIDE
131 { 144 {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) 944 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
932 { 945 {
933 int scriptId = 0; 946 int scriptId = 0;
934 String resourceName; 947 String resourceName;
935 int lineNumber = 1; 948 int lineNumber = 1;
936 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r); 949 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r);
937 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber); 950 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber);
938 } 951 }
939 952
940 } // namespace WebCore 953 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/V8Callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698