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 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return v8::Undefined(); | 409 return v8::Undefined(); |
410 } | 410 } |
411 | 411 |
412 inline v8::Handle<v8::Primitive> throwError(v8::Local<v8::Value> exception) | 412 inline v8::Handle<v8::Primitive> throwError(v8::Local<v8::Value> exception) |
413 { | 413 { |
414 if (!v8::V8::IsExecutionTerminating()) | 414 if (!v8::V8::IsExecutionTerminating()) |
415 v8::ThrowException(exception); | 415 v8::ThrowException(exception); |
416 return v8::Undefined(); | 416 return v8::Undefined(); |
417 } | 417 } |
418 | 418 |
419 template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object,
v8::Local<v8::Object> holder) | 419 enum IndependentMode { |
| 420 MarkIndependent, |
| 421 DoNotMarkIndependent |
| 422 }; |
| 423 |
| 424 template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object,
v8::Local<v8::Object> holder, IndependentMode independent = DoNotMarkIndependent
) |
420 { | 425 { |
421 object->ref(); | 426 object->ref(); |
422 V8DOMWrapper::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::
Object>::New(holder)); | 427 v8::Persistent<v8::Object> handle = v8::Persistent<v8::Object>::New(hold
er); |
| 428 if (independent == MarkIndependent) |
| 429 handle.MarkIndependent(); |
| 430 V8DOMWrapper::setJSWrapperForDOMObject(object.get(), handle); |
423 return holder; | 431 return holder; |
424 } | 432 } |
425 | 433 |
426 } | 434 } |
427 | 435 |
428 #endif // V8Proxy_h | 436 #endif // V8Proxy_h |
OLD | NEW |