Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.h

Issue 1389383003: WIP: Introduce CompressibleString Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // Return a V8 external string that shares the underlying buffer with the given 426 // 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 427 // 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. 428 // 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 ) 429 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, const String& string )
430 { 430 {
431 if (string.isNull()) 431 if (string.isNull())
432 return v8::String::Empty(isolate); 432 return v8::String::Empty(isolate);
433 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol ate, string.impl()); 433 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol ate, string.impl());
434 } 434 }
435 435
436 inline v8::Local<v8::String> v8String(v8::Isolate* isolate, RefPtrWillBeRawPtr<C ompressableString> string)
437 {
438 if (!string)
439 return v8::String::Empty(isolate);
440 return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(isol ate, string);
441 }
442
436 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st r, int length = -1) 443 inline v8::Local<v8::String> v8AtomicString(v8::Isolate* isolate, const char* st r, int length = -1)
437 { 444 {
438 ASSERT(isolate); 445 ASSERT(isolate);
439 v8::Local<v8::String> value; 446 v8::Local<v8::String> value;
440 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna lized, length).ToLocal(&value))) 447 if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInterna lized, length).ToLocal(&value)))
441 return value; 448 return value;
442 // Immediately crashes when NewFromUtf8() fails because it only fails the 449 // Immediately crashes when NewFromUtf8() fails because it only fails the
443 // given str is too long. 450 // given str is too long.
444 RELEASE_ASSERT_NOT_REACHED(); 451 RELEASE_ASSERT_NOT_REACHED();
445 return v8::String::Empty(isolate); 452 return v8::String::Empty(isolate);
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Local<v8::Function>); 1091 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Local<v8::Function>);
1085 1092
1086 // Callback functions used by generated code. 1093 // Callback functions used by generated code.
1087 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1094 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1088 1095
1089 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1096 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1090 1097
1091 } // namespace blink 1098 } // namespace blink
1092 1099
1093 #endif // V8Binding_h 1100 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698