OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #include "SerializedScriptValue.h" | 34 #include "SerializedScriptValue.h" |
35 #include "V8Binding.h" | 35 #include "V8Binding.h" |
36 #include <wtf/Vector.h> | 36 #include <wtf/Vector.h> |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value) | 40 PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value) |
41 { | 41 { |
42 if (value->IsNull()) | 42 if (value->IsNull()) |
43 return IDBKey::create(); | 43 return IDBKey::create(); |
44 if (value->IsInt32()) | 44 if (value->IsNumber()) |
45 return IDBKey::create(value->Int32Value()); | 45 return IDBKey::create(value->NumberValue()); |
46 if (value->IsString()) | 46 if (value->IsString()) |
47 return IDBKey::create(v8ValueToWebCoreString(value)); | 47 return IDBKey::create(v8ValueToWebCoreString(value)); |
48 if (value->IsDate()) | 48 if (value->IsDate()) |
49 return 0; // Signals type error. FIXME: Implement dates. | 49 return 0; // Signals type error. FIXME: Implement dates. |
50 | 50 |
51 return 0; // Signals type error. | 51 return 0; // Signals type error. |
52 } | 52 } |
53 | 53 |
54 template<typename T> | 54 template<typename T> |
55 bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value) | 55 bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 default: | 97 default: |
98 ASSERT_NOT_REACHED(); | 98 ASSERT_NOT_REACHED(); |
99 } | 99 } |
100 } | 100 } |
101 return createIDBKeyFromValue(v8Value); | 101 return createIDBKeyFromValue(v8Value); |
102 } | 102 } |
103 | 103 |
104 } // namespace WebCore | 104 } // namespace WebCore |
105 | 105 |
106 #endif | 106 #endif |
OLD | NEW |