| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 #include "bindings/v8/V8Binding.h" | 35 #include "bindings/v8/V8Binding.h" |
| 36 #include "bindings/v8/V8DOMWrapper.h" | 36 #include "bindings/v8/V8DOMWrapper.h" |
| 37 #include "bindings/v8/V8MutationCallback.h" | 37 #include "bindings/v8/V8MutationCallback.h" |
| 38 #include "bindings/v8/V8Utilities.h" | 38 #include "bindings/v8/V8Utilities.h" |
| 39 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
| 40 #include "core/dom/MutationObserver.h" | 40 #include "core/dom/MutationObserver.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 v8::Handle<v8::Value> V8MutationObserver::constructorCustom(const v8::Arguments&
args) | 44 void V8MutationObserver::constructorCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& args) |
| 45 { | 45 { |
| 46 if (args.Length() < 1) | 46 if (args.Length() < 1) { |
| 47 return throwNotEnoughArgumentsError(args.GetIsolate()); | 47 throwNotEnoughArgumentsError(args.GetIsolate()); |
| 48 return; |
| 49 } |
| 48 | 50 |
| 49 v8::Local<v8::Value> arg = args[0]; | 51 v8::Local<v8::Value> arg = args[0]; |
| 50 if (!arg->IsFunction()) | 52 if (!arg->IsFunction()) { |
| 51 return throwTypeError("Callback argument must be a function", args.GetIs
olate()); | 53 throwTypeError("Callback argument must be a function", args.GetIsolate()
); |
| 54 return; |
| 55 } |
| 52 | 56 |
| 53 ScriptExecutionContext* context = getScriptExecutionContext(); | 57 ScriptExecutionContext* context = getScriptExecutionContext(); |
| 54 v8::Handle<v8::Object> wrapper = args.Holder(); | 58 v8::Handle<v8::Object> wrapper = args.Holder(); |
| 55 | 59 |
| 56 RefPtr<MutationCallback> callback = V8MutationCallback::create(v8::Handle<v8
::Function>::Cast(arg), context, wrapper, args.GetIsolate()); | 60 RefPtr<MutationCallback> callback = V8MutationCallback::create(v8::Handle<v8
::Function>::Cast(arg), context, wrapper, args.GetIsolate()); |
| 57 RefPtr<MutationObserver> observer = MutationObserver::create(callback.releas
e()); | 61 RefPtr<MutationObserver> observer = MutationObserver::create(callback.releas
e()); |
| 58 | 62 |
| 59 V8DOMWrapper::associateObjectWithWrapper(observer.release(), &info, wrapper,
args.GetIsolate(), WrapperConfiguration::Dependent); | 63 V8DOMWrapper::associateObjectWithWrapper(observer.release(), &info, wrapper,
args.GetIsolate(), WrapperConfiguration::Dependent); |
| 60 return wrapper; | 64 args.GetReturnValue().Set(wrapper); |
| 61 } | 65 } |
| 62 | 66 |
| 63 } // namespace WebCore | 67 } // namespace WebCore |
| OLD | NEW |