| 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/ScriptValue.h" | 41 #include "bindings/core/v8/ScriptValue.h" |
| 42 #include "bindings/core/v8/ScriptWrappable.h" | 42 #include "bindings/core/v8/ScriptWrappable.h" |
| 43 #include "bindings/core/v8/V8BindingMacros.h" | 43 #include "bindings/core/v8/V8BindingMacros.h" |
| 44 #include "bindings/core/v8/V8PerIsolateData.h" | 44 #include "bindings/core/v8/V8PerIsolateData.h" |
| 45 #include "bindings/core/v8/V8ScriptRunner.h" | 45 #include "bindings/core/v8/V8ScriptRunner.h" |
| 46 #include "bindings/core/v8/V8StringResource.h" | 46 #include "bindings/core/v8/V8StringResource.h" |
| 47 #include "bindings/core/v8/V8ThrowException.h" | 47 #include "bindings/core/v8/V8ThrowException.h" |
| 48 #include "bindings/core/v8/V8ValueCache.h" | 48 #include "bindings/core/v8/V8ValueCache.h" |
| 49 #include "core/CoreExport.h" | 49 #include "core/CoreExport.h" |
| 50 #include "platform/heap/Handle.h" | 50 #include "platform/heap/Handle.h" |
| 51 #include "platform/text/CompressibleString.h" | |
| 52 #include "wtf/text/AtomicString.h" | 51 #include "wtf/text/AtomicString.h" |
| 53 #include "wtf/text/StringView.h" | 52 #include "wtf/text/StringView.h" |
| 54 #include <v8.h> | 53 #include <v8.h> |
| 55 | 54 |
| 56 namespace blink { | 55 namespace blink { |
| 57 | 56 |
| 58 class DOMWindow; | 57 class DOMWindow; |
| 59 class EventListener; | 58 class EventListener; |
| 60 class EventTarget; | 59 class EventTarget; |
| 61 class ExceptionState; | 60 class ExceptionState; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); | 407 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); |
| 409 } | 408 } |
| 410 | 409 |
| 411 inline v8::Local<v8::Value> v8StringOrNull(v8::Isolate* isolate, const AtomicStr
ing& string) | 410 inline v8::Local<v8::Value> v8StringOrNull(v8::Isolate* isolate, const AtomicStr
ing& string) |
| 412 { | 411 { |
| 413 if (string.isNull()) | 412 if (string.isNull()) |
| 414 return v8::Null(isolate); | 413 return v8::Null(isolate); |
| 415 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); | 414 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string.impl()); |
| 416 } | 415 } |
| 417 | 416 |
| 418 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const CompressibleSt
ring& string) | |
| 419 { | |
| 420 if (string.isNull()) | |
| 421 return v8::String::Empty(isolate); | |
| 422 return V8PerIsolateData::from(isolate)->getStringCache()->v8ExternalString(i
solate, string); | |
| 423 } | |
| 424 | |
| 425 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const StringVi
ew& string) | 417 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const StringVi
ew& string) |
| 426 { | 418 { |
| 427 DCHECK(isolate); | 419 DCHECK(isolate); |
| 428 if (string.is8Bit()) | 420 if (string.is8Bit()) |
| 429 return v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_
t*>(string.characters8()), v8::NewStringType::kInternalized, static_cast<int>(st
ring.length())).ToLocalChecked(); | 421 return v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_
t*>(string.characters8()), v8::NewStringType::kInternalized, static_cast<int>(st
ring.length())).ToLocalChecked(); |
| 430 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>
(string.characters16()), v8::NewStringType::kInternalized, static_cast<int>(stri
ng.length())).ToLocalChecked(); | 422 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>
(string.characters16()), v8::NewStringType::kInternalized, static_cast<int>(stri
ng.length())).ToLocalChecked(); |
| 431 } | 423 } |
| 432 | 424 |
| 433 inline v8::Local<v8::String> v8StringFromUtf8(v8::Isolate* isolate, const char*
bytes, int length) | 425 inline v8::Local<v8::String> v8StringFromUtf8(v8::Isolate* isolate, const char*
bytes, int length) |
| 434 { | 426 { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); | 957 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); |
| 966 | 958 |
| 967 // Freeze a V8 object. The type of the first parameter and the return value is | 959 // Freeze a V8 object. The type of the first parameter and the return value is |
| 968 // intentionally v8::Value so that this function can wrap toV8(). | 960 // intentionally v8::Value so that this function can wrap toV8(). |
| 969 // If the argument isn't an object, this will crash. | 961 // If the argument isn't an object, this will crash. |
| 970 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); | 962 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); |
| 971 | 963 |
| 972 } // namespace blink | 964 } // namespace blink |
| 973 | 965 |
| 974 #endif // V8Binding_h | 966 #endif // V8Binding_h |
| OLD | NEW |