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

Side by Side Diff: Source/bindings/core/v8/custom/V8PerformanceCustom.cpp

Issue 1198863006: First version of PerformanceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync with latest spec draft (DOMString -> PerformanceEntryType and new PerformanceObserver -> windo… Created 5 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved.
esprehn 2015/07/18 22:24:15 Please use the short copyright in all your files.
MikeB 2015/07/20 23:06:50 Done.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "config.h"
32 #include "bindings/core/v8/V8Performance.h"
33
34 #include "bindings/core/v8/ExceptionMessages.h"
35 #include "bindings/core/v8/ExceptionState.h"
36 #include "bindings/core/v8/V8Binding.h"
37 #include "bindings/core/v8/V8DOMWrapper.h"
38 #include "bindings/core/v8/V8GCController.h"
39 #include "bindings/core/v8/V8PerformanceObserverCallback.h"
40 #include "core/timing/DOMWindowPerformance.h"
41 #include "core/timing/PerformanceObserver.h"
42
43 namespace blink {
44
45 void V8Performance::createPerformanceObserverMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
esprehn 2015/07/18 22:24:15 hmm, does this really need to be custom? The code
MikeB 2015/07/20 23:06:50 I couldn't get code generator to correctly do line
46 {
47 if (UNLIKELY(info.Length() < 1)) {
48 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(in fo.GetIsolate(), "createPerformanceObserver", "Performance", 1, info.Length()), info.GetIsolate());
49 return;
50 }
51 Performance* impl = V8Performance::toImpl(info.Holder());
52 PerformanceObserverCallback* callback;
53 {
54 if (info.Length() <= 0 || !info[0]->IsFunction()) {
55 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessage s::failedToExecute("createPerformanceObserver", "Performance", "The callback pro vided as parameter 1 is not a function."));
56 return;
57 }
58 callback = V8PerformanceObserverCallback::create(v8::Local<v8::Function> ::Cast(info[0]), ScriptState::current(info.GetIsolate()));
59 }
60 v8SetReturnValue(info, impl->createPerformanceObserver(callback));
61 }
62
63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698