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

Side by Side Diff: Source/bindings/v8/custom/V8DataViewCustom.cpp

Issue 15877002: move constructors to new style callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/html/canvas/DataView.h" 27 #include "core/html/canvas/DataView.h"
28 28
29 #include "V8DataView.h" 29 #include "V8DataView.h"
30 #include "bindings/v8/V8Binding.h" 30 #include "bindings/v8/V8Binding.h"
31 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" 31 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
32 32
33 namespace WebCore { 33 namespace WebCore {
34 34
35 v8::Handle<v8::Value> V8DataView::constructorCustom(const v8::Arguments& args) 35 void V8DataView::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& ar gs)
36 { 36 {
37 if (!args.Length()) { 37 if (!args.Length()) {
38 // see constructWebGLArray -- we don't seem to be able to distingish bet ween 38 // see constructWebGLArray -- we don't seem to be able to distingish bet ween
39 // 'new DataView()' and the call used to construct the cached DataView o bject. 39 // 'new DataView()' and the call used to construct the cached DataView o bject.
40 RefPtr<DataView> dataView = DataView::create(0); 40 RefPtr<DataView> dataView = DataView::create(0);
41 v8::Handle<v8::Object> wrapper = args.Holder(); 41 v8::Handle<v8::Object> wrapper = args.Holder();
42 V8DOMWrapper::associateObjectWithWrapper(dataView.release(), &info, wrap per, args.GetIsolate(), WrapperConfiguration::Dependent); 42 V8DOMWrapper::associateObjectWithWrapper(dataView.release(), &info, wrap per, args.GetIsolate(), WrapperConfiguration::Dependent);
43 return wrapper; 43 args.GetReturnValue().Set(wrapper);
44 return;
44 } 45 }
45 if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0], args.GetIsolat e(), worldType(args.GetIsolate()))) 46 if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0], args.GetIsolat e(), worldType(args.GetIsolate()))) {
46 return throwTypeError(0, args.GetIsolate()); 47 throwTypeError(0, args.GetIsolate());
47 return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &inf o, v8::kExternalByteArray, false); 48 return;
49 }
50 constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8:: kExternalByteArray, false);
48 } 51 }
49 52
50 // FIXME: Don't need this override. 53 // FIXME: Don't need this override.
51 v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 54 v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
52 { 55 {
53 ASSERT(impl); 56 ASSERT(impl);
54 return V8DataView::createWrapper(impl, creationContext, isolate); 57 return V8DataView::createWrapper(impl, creationContext, isolate);
55 } 58 }
56 59
57 v8::Handle<v8::Value> V8DataView::getInt8MethodCustom(const v8::Arguments& args) 60 v8::Handle<v8::Value> V8DataView::getInt8MethodCustom(const v8::Arguments& args)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ExceptionCode ec = 0; 109 ExceptionCode ec = 0;
107 V8TRYCATCH(unsigned, byteOffset, toUInt32(args[0])); 110 V8TRYCATCH(unsigned, byteOffset, toUInt32(args[0]));
108 V8TRYCATCH(int, value, toInt32(args[1])); 111 V8TRYCATCH(int, value, toInt32(args[1]));
109 imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec); 112 imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec);
110 if (UNLIKELY(ec)) 113 if (UNLIKELY(ec))
111 return setDOMException(ec, args.GetIsolate()); 114 return setDOMException(ec, args.GetIsolate());
112 return v8Undefined(); 115 return v8Undefined();
113 } 116 }
114 117
115 } // namespace WebCore 118 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8DOMPointCustom.cpp ('k') | Source/bindings/v8/custom/V8FormDataCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698