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

Side by Side Diff: Source/bindings/v8/V8Callback.h

Issue 111603006: Simplify invokeCallback() and support void return values for IDL callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 22 matching lines...) Expand all
33 33
34 #include "bindings/v8/V8Binding.h" 34 #include "bindings/v8/V8Binding.h"
35 #include "bindings/v8/V8Utilities.h" 35 #include "bindings/v8/V8Utilities.h"
36 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
37 #include <v8.h> 37 #include <v8.h>
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class ExecutionContext; 41 class ExecutionContext;
42 42
43 bool invokeCallback(v8::Handle<v8::Object> callback, int argc, v8::Handle<v8::Va lue> argv[], bool& callbackReturnValue, ExecutionContext*, v8::Isolate*); 43 // Returns false if the callback threw an exception, true otherwise.
44 bool invokeCallback(v8::Handle<v8::Object> callback, v8::Handle<v8::Object> this Object, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, Execu tionContext*, v8::Isolate*); 44 bool invokeCallback(v8::Local<v8::Function> callback, int argc, v8::Handle<v8::V alue> argv[], ExecutionContext*, v8::Isolate*);
45 bool invokeCallback(v8::Local<v8::Function> callback, v8::Handle<v8::Object> thi sObject, int argc, v8::Handle<v8::Value> argv[], ExecutionContext*, v8::Isolate* );
45 46
46 enum CallbackAllowedValueFlag { 47 enum CallbackAllowedValueFlag {
47 CallbackAllowUndefined = 1, 48 CallbackAllowUndefined = 1,
48 CallbackAllowNull = 1 << 1 49 CallbackAllowNull = 1 << 1
49 }; 50 };
50 51
51 typedef unsigned CallbackAllowedValueFlags; 52 typedef unsigned CallbackAllowedValueFlags;
52 53
53 // 'FunctionOnly' is assumed for the created callback. 54 // 'FunctionOnly' is assumed for the created callback.
54 template <typename V8CallbackType> 55 template <typename V8CallbackType>
(...skipping 12 matching lines...) Expand all
67 setDOMException(TypeMismatchError, isolate); 68 setDOMException(TypeMismatchError, isolate);
68 return nullptr; 69 return nullptr;
69 } 70 }
70 71
71 return V8CallbackType::create(v8::Handle<v8::Function>::Cast(value), getExec utionContext()); 72 return V8CallbackType::create(v8::Handle<v8::Function>::Cast(value), getExec utionContext());
72 } 73 }
73 74
74 } // namespace WebCore 75 } // namespace WebCore
75 76
76 #endif // V8Callback_h 77 #endif // V8Callback_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698