OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "bindings/core/v8/ScriptWrappable.h" | 41 #include "bindings/core/v8/ScriptWrappable.h" |
42 #include "bindings/core/v8/V8BindingMacros.h" | 42 #include "bindings/core/v8/V8BindingMacros.h" |
43 #include "bindings/core/v8/V8PerIsolateData.h" | 43 #include "bindings/core/v8/V8PerIsolateData.h" |
44 #include "bindings/core/v8/V8StringResource.h" | 44 #include "bindings/core/v8/V8StringResource.h" |
45 #include "bindings/core/v8/V8ThrowException.h" | 45 #include "bindings/core/v8/V8ThrowException.h" |
46 #include "bindings/core/v8/V8ValueCache.h" | 46 #include "bindings/core/v8/V8ValueCache.h" |
47 #include "core/CoreExport.h" | 47 #include "core/CoreExport.h" |
48 #include "platform/JSONValues.h" | 48 #include "platform/JSONValues.h" |
49 #include "platform/heap/Handle.h" | 49 #include "platform/heap/Handle.h" |
50 #include "wtf/text/AtomicString.h" | 50 #include "wtf/text/AtomicString.h" |
| 51 #include "wtf/text/CompressibleString.h" |
51 #include <v8.h> | 52 #include <v8.h> |
52 | 53 |
53 namespace blink { | 54 namespace blink { |
54 | 55 |
55 class DOMWindow; | 56 class DOMWindow; |
56 class EventListener; | 57 class EventListener; |
57 class EventTarget; | 58 class EventTarget; |
58 class ExceptionState; | 59 class ExceptionState; |
59 class ExecutionContext; | 60 class ExecutionContext; |
60 class FlexibleArrayBufferView; | 61 class FlexibleArrayBufferView; |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // Return a V8 external string that shares the underlying buffer with the given | 427 // Return a V8 external string that shares the underlying buffer with the given |
427 // WebCore string. The reference counting mechanism is used to keep the | 428 // WebCore string. The reference counting mechanism is used to keep the |
428 // underlying buffer alive while the string is still live in the V8 engine. | 429 // underlying buffer alive while the string is still live in the V8 engine. |
429 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) | 430 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) |
430 { | 431 { |
431 if (string.isNull()) | 432 if (string.isNull()) |
432 return v8::String::Empty(isolate); | 433 return v8::String::Empty(isolate); |
433 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string.impl()); | 434 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string.impl()); |
434 } | 435 } |
435 | 436 |
| 437 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) |
| 438 { |
| 439 if (string.isNull()) |
| 440 return v8::String::Empty(isolate); |
| 441 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string); |
| 442 } |
| 443 |
436 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) | 444 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) |
437 { | 445 { |
438 ASSERT(isolate); | 446 ASSERT(isolate); |
439 v8::Local<v8::String> value; | 447 v8::Local<v8::String> value; |
440 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna
lized, length).ToLocal(&value))) | 448 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna
lized, length).ToLocal(&value))) |
441 return value; | 449 return value; |
442 // Immediately crashes when NewFromUtf8() fails because it only fails the | 450 // Immediately crashes when NewFromUtf8() fails because it only fails the |
443 // given str is too long. | 451 // given str is too long. |
444 RELEASE_ASSERT_NOT_REACHED(); | 452 RELEASE_ASSERT_NOT_REACHED(); |
445 return v8::String::Empty(isolate); | 453 return v8::String::Empty(isolate); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); | 1092 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); |
1085 | 1093 |
1086 // Callback functions used by generated code. | 1094 // Callback functions used by generated code. |
1087 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 1095 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
1088 | 1096 |
1089 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 1097 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
1090 | 1098 |
1091 } // namespace blink | 1099 } // namespace blink |
1092 | 1100 |
1093 #endif // V8Binding_h | 1101 #endif // V8Binding_h |
OLD | NEW |