| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 new WebCoreStringResource16(result); | 141 new WebCoreStringResource16(result); |
| 142 if (UNLIKELY(!v8String->MakeExternal(stringResource))) | 142 if (UNLIKELY(!v8String->MakeExternal(stringResource))) |
| 143 delete stringResource; | 143 delete stringResource; |
| 144 } | 144 } |
| 145 return result; | 145 return result; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Explicitly instantiate the above template with the expected | 148 // Explicitly instantiate the above template with the expected |
| 149 // parameterizations, to ensure the compiler generates the code; otherwise link | 149 // parameterizations, to ensure the compiler generates the code; otherwise link |
| 150 // errors can result in GCC 4.4. | 150 // errors can result in GCC 4.4. |
| 151 template String v8StringToWebCoreString<String>(v8::Local<v8::String>, | 151 template String V8StringToWebCoreString<String>(v8::Local<v8::String>, |
| 152 ExternalMode); | 152 ExternalMode); |
| 153 template AtomicString v8StringToWebCoreString<AtomicString>( | 153 template AtomicString V8StringToWebCoreString<AtomicString>( |
| 154 v8::Local<v8::String>, | 154 v8::Local<v8::String>, |
| 155 ExternalMode); | 155 ExternalMode); |
| 156 | 156 |
| 157 // Fast but non thread-safe version. | 157 // Fast but non thread-safe version. |
| 158 String int32ToWebCoreStringFast(int value) { | 158 String int32ToWebCoreStringFast(int value) { |
| 159 // Caching of small strings below is not thread safe: newly constructed | 159 // Caching of small strings below is not thread safe: newly constructed |
| 160 // AtomicString are not safely published. | 160 // AtomicString are not safely published. |
| 161 ASSERT(isMainThread()); | 161 ASSERT(isMainThread()); |
| 162 | 162 |
| 163 // Most numbers used are <= 100. Even if they aren't used there's very little | 163 // Most numbers used are <= 100. Even if they aren't used there's very little |
| (...skipping 16 matching lines...) Expand all Loading... |
| 180 | 180 |
| 181 String int32ToWebCoreString(int value) { | 181 String int32ToWebCoreString(int value) { |
| 182 // If we are on the main thread (this should always true for non-workers), | 182 // If we are on the main thread (this should always true for non-workers), |
| 183 // call the faster one. | 183 // call the faster one. |
| 184 if (isMainThread()) | 184 if (isMainThread()) |
| 185 return int32ToWebCoreStringFast(value); | 185 return int32ToWebCoreStringFast(value); |
| 186 return String::number(value); | 186 return String::number(value); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace blink | 189 } // namespace blink |
| OLD | NEW |