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/V8SQLTransactionCustom.cpp

Issue 234403004: Rename V8TRYCATCH_* macros in v8/V8BindingMacros.h (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: BOOL*_BOOL -> BOOL* Created 6 years, 8 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 void V8SQLTransaction::executeSqlMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info) 48 void V8SQLTransaction::executeSqlMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info)
49 { 49 {
50 ExceptionState exceptionState(ExceptionState::ExecutionContext, "executeSql" , "SQLTransaction", info.Holder(), info.GetIsolate()); 50 ExceptionState exceptionState(ExceptionState::ExecutionContext, "executeSql" , "SQLTransaction", info.Holder(), info.GetIsolate());
51 if (!info.Length()) { 51 if (!info.Length()) {
52 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::notEnou ghArguments(1, 0)); 52 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::notEnou ghArguments(1, 0));
53 exceptionState.throwIfNeeded(); 53 exceptionState.throwIfNeeded();
54 return; 54 return;
55 } 55 }
56 56
57 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, statement, info[0]) ; 57 TOSTRING_VOID(V8StringResource<>, statement, info[0]);
58 58
59 Vector<SQLValue> sqlValues; 59 Vector<SQLValue> sqlValues;
60 60
61 if (info.Length() > 1 && !isUndefinedOrNull(info[1])) { 61 if (info.Length() > 1 && !isUndefinedOrNull(info[1])) {
62 if (!info[1]->IsObject()) { 62 if (!info[1]->IsObject()) {
63 exceptionState.throwDOMException(TypeMismatchError, "The 'arguments' (2nd) argument provided is not an object."); 63 exceptionState.throwDOMException(TypeMismatchError, "The 'arguments' (2nd) argument provided is not an object.");
64 exceptionState.throwIfNeeded(); 64 exceptionState.throwIfNeeded();
65 return; 65 return;
66 } 66 }
67 67
68 uint32_t sqlArgsLength = 0; 68 uint32_t sqlArgsLength = 0;
69 v8::Local<v8::Object> sqlArgsObject = info[1]->ToObject(); 69 v8::Local<v8::Object> sqlArgsObject = info[1]->ToObject();
70 V8TRYCATCH_VOID(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8Atomi cString(info.GetIsolate(), "length"))); 70 TONATIVE_VOID(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8AtomicS tring(info.GetIsolate(), "length")));
71 71
72 if (isUndefinedOrNull(length)) 72 if (isUndefinedOrNull(length))
73 sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length(); 73 sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length();
74 else 74 else
75 sqlArgsLength = length->Uint32Value(); 75 sqlArgsLength = length->Uint32Value();
76 76
77 for (unsigned i = 0; i < sqlArgsLength; ++i) { 77 for (unsigned i = 0; i < sqlArgsLength; ++i) {
78 v8::Handle<v8::Integer> key = v8::Integer::New(info.GetIsolate(), i) ; 78 v8::Handle<v8::Integer> key = v8::Integer::New(info.GetIsolate(), i) ;
79 V8TRYCATCH_VOID(v8::Local<v8::Value>, value, sqlArgsObject->Get(key) ); 79 TONATIVE_VOID(v8::Local<v8::Value>, value, sqlArgsObject->Get(key));
80 80
81 if (value.IsEmpty() || value->IsNull()) 81 if (value.IsEmpty() || value->IsNull())
82 sqlValues.append(SQLValue()); 82 sqlValues.append(SQLValue());
83 else if (value->IsNumber()) { 83 else if (value->IsNumber()) {
84 V8TRYCATCH_VOID(double, sqlValue, value->NumberValue()); 84 TONATIVE_VOID(double, sqlValue, value->NumberValue());
85 sqlValues.append(SQLValue(sqlValue)); 85 sqlValues.append(SQLValue(sqlValue));
86 } else { 86 } else {
87 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, sqlValu e, value); 87 TOSTRING_VOID(V8StringResource<>, sqlValue, value);
88 sqlValues.append(SQLValue(sqlValue)); 88 sqlValues.append(SQLValue(sqlValue));
89 } 89 }
90 } 90 }
91 } 91 }
92 92
93 SQLTransaction* transaction = V8SQLTransaction::toNative(info.Holder()); 93 SQLTransaction* transaction = V8SQLTransaction::toNative(info.Holder());
94 94
95 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 95 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
96 96
97 OwnPtr<SQLStatementCallback> callback; 97 OwnPtr<SQLStatementCallback> callback;
(...skipping 14 matching lines...) Expand all
112 return; 112 return;
113 } 113 }
114 errorCallback = V8SQLStatementErrorCallback::create(v8::Handle<v8::Funct ion>::Cast(info[3]), executionContext); 114 errorCallback = V8SQLStatementErrorCallback::create(v8::Handle<v8::Funct ion>::Cast(info[3]), executionContext);
115 } 115 }
116 116
117 transaction->executeSQL(statement, sqlValues, callback.release(), errorCallb ack.release(), exceptionState); 117 transaction->executeSQL(statement, sqlValues, callback.release(), errorCallb ack.release(), exceptionState);
118 exceptionState.throwIfNeeded(); 118 exceptionState.throwIfNeeded();
119 } 119 }
120 120
121 } // namespace WebCore 121 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8PromiseCustom.cpp ('k') | Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698