Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 { \ | 73 { \ |
| 74 v8::TryCatch block; \ | 74 v8::TryCatch block; \ |
| 75 var = (value); \ | 75 var = (value); \ |
| 76 if (UNLIKELY(block.HasCaught())) \ | 76 if (UNLIKELY(block.HasCaught())) \ |
| 77 exceptionState.rethrowV8Exception(block.Exception()); \ | 77 exceptionState.rethrowV8Exception(block.Exception()); \ |
| 78 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 78 if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
| 79 return; \ | 79 return; \ |
| 80 } | 80 } |
| 81 | 81 |
| 82 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \ | 82 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \ |
| 83 type var; \ | 83 type var; \ |
| 84 { \ | 84 { \ |
| 85 v8::TryCatch block; \ | 85 v8::TryCatch block; \ |
| 86 var = (value); \ | 86 var = (value); \ |
| 87 if (UNLIKELY(block.HasCaught())) \ | 87 if (UNLIKELY(block.HasCaught())) \ |
| 88 exceptionState.rethrowV8Exception(block.Exception()); \ | 88 exceptionState.rethrowV8Exception(block.Exception()); \ |
| 89 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 89 if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
| 90 return retVal; \ | 90 return retVal; \ |
| 91 } | 91 } |
| 92 | 92 |
| 93 // type is an instance of class template V8StringResource<>, | 93 // type is an instance of class template V8StringResource<>, |
| 94 // but Mode argument varies; using type (not Mode) for consistency | 94 // but Mode argument varies; using type (not Mode) for consistency |
| 95 // with other macros and ease of code generation | 95 // with other macros and ease of code generation |
| 96 #define TOSTRING_VOID(type, var, value) \ | 96 #define TOSTRING_VOID(type, var, value) \ |
| 97 type var(value); \ | 97 type var(value); \ |
| 98 if (UNLIKELY(!var.prepare())) \ | 98 if (UNLIKELY(!var.setStringAsPrimitive())) { \ |
|
haraken
2014/04/21 03:57:02
Shall we rename as follows?
setStringAsPrimitive
yhirano
2014/04/21 04:08:06
Done.
| |
| 99 return; | 99 v8::TryCatch block; \ |
| 100 var.setStringWithToString(); \ | |
| 101 if (UNLIKELY(block.HasCaught())) { \ | |
| 102 block.ReThrow(); \ | |
| 103 return; \ | |
| 104 } \ | |
| 105 } | |
| 100 | 106 |
| 101 #define TOSTRING_DEFAULT(type, var, value, retVal) \ | 107 #define TOSTRING_DEFAULT(type, var, value, retVal) \ |
| 102 type var(value); \ | 108 type var(value); \ |
| 103 if (UNLIKELY(!var.prepare())) \ | 109 if (UNLIKELY(!var.setStringAsPrimitive())) { \ |
| 104 return retVal; | 110 v8::TryCatch block; \ |
| 111 var.setStringWithToString(); \ | |
| 112 if (UNLIKELY(block.HasCaught())) { \ | |
| 113 block.ReThrow(); \ | |
| 114 return retVal; \ | |
| 115 } \ | |
| 116 } | |
| 105 | 117 |
| 106 } // namespace WebCore | 118 } // namespace WebCore |
| 107 | 119 |
| 108 #endif // V8BindingMacros_h | 120 #endif // V8BindingMacros_h |
| OLD | NEW |