| 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 29 matching lines...) Expand all Loading... |
| 40 #include "bindings/core/v8/ScriptValue.h" | 40 #include "bindings/core/v8/ScriptValue.h" |
| 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 "platform/text/CompressibleString.h" |
| 50 #include "wtf/text/AtomicString.h" | 51 #include "wtf/text/AtomicString.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; |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // Return a V8 external string that shares the underlying buffer with the given | 428 // Return a V8 external string that shares the underlying buffer with the given |
| 428 // WebCore string. The reference counting mechanism is used to keep the | 429 // WebCore string. The reference counting mechanism is used to keep the |
| 429 // underlying buffer alive while the string is still live in the V8 engine. | 430 // underlying buffer alive while the string is still live in the V8 engine. |
| 430 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) | 431 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string
) |
| 431 { | 432 { |
| 432 if (string.isNull()) | 433 if (string.isNull()) |
| 433 return v8::String::Empty(isolate); | 434 return v8::String::Empty(isolate); |
| 434 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string.impl()); | 435 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string.impl()); |
| 435 } | 436 } |
| 436 | 437 |
| 438 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) |
| 439 { |
| 440 if (string.isNull()) |
| 441 return v8::String::Empty(isolate); |
| 442 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol
ate, string); |
| 443 } |
| 444 |
| 437 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) | 445 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st
r, int length = -1) |
| 438 { | 446 { |
| 439 ASSERT(isolate); | 447 ASSERT(isolate); |
| 440 v8::Local<v8::String> value; | 448 v8::Local<v8::String> value; |
| 441 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna
lized, length).ToLocal(&value))) | 449 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna
lized, length).ToLocal(&value))) |
| 442 return value; | 450 return value; |
| 443 // Immediately crashes when NewFromUtf8() fails because it only fails the | 451 // Immediately crashes when NewFromUtf8() fails because it only fails the |
| 444 // given str is too long. | 452 // given str is too long. |
| 445 RELEASE_ASSERT_NOT_REACHED(); | 453 RELEASE_ASSERT_NOT_REACHED(); |
| 446 return v8::String::Empty(isolate); | 454 return v8::String::Empty(isolate); |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); | 1094 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); |
| 1087 | 1095 |
| 1088 // Callback functions used by generated code. | 1096 // Callback functions used by generated code. |
| 1089 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 1097 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
| 1090 | 1098 |
| 1091 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 1099 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
| 1092 | 1100 |
| 1093 } // namespace blink | 1101 } // namespace blink |
| 1094 | 1102 |
| 1095 #endif // V8Binding_h | 1103 #endif // V8Binding_h |
| OLD | NEW |