OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 604 |
605 void crashIfV8IsDead() | 605 void crashIfV8IsDead() |
606 { | 606 { |
607 if (v8::V8::IsDead()) { | 607 if (v8::V8::IsDead()) { |
608 // FIXME: We temporarily deal with V8 internal error situations | 608 // FIXME: We temporarily deal with V8 internal error situations |
609 // such as out-of-memory by crashing the renderer. | 609 // such as out-of-memory by crashing the renderer. |
610 CRASH(); | 610 CRASH(); |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 WrapperWorldType worldType(v8::Isolate* isolate) | |
615 { | |
616 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
617 if (data->isMainThread()) | |
618 return worldTypeInMainThread(isolate); | |
619 return WorkerWorld; | |
620 } | |
621 | |
622 WrapperWorldType worldTypeInMainThread(v8::Isolate* isolate) | |
623 { | |
624 if (!DOMWrapperWorld::isolatedWorldsExist()) | |
625 return MainWorld; | |
626 ASSERT(!isolate->GetEnteredContext().IsEmpty()); | |
627 DOMWrapperWorld* world = DOMWrapperWorld::world(isolate->GetEnteredContext()
); | |
628 if (world->isMainWorld()) | |
629 return MainWorld; | |
630 return IsolatedWorld; | |
631 } | |
632 | |
633 v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function) | 614 v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function) |
634 { | 615 { |
635 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); | 616 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); |
636 return boundFunction->IsFunction() ? v8::Handle<v8::Function>::Cast(boundFun
ction) : function; | 617 return boundFunction->IsFunction() ? v8::Handle<v8::Function>::Cast(boundFun
ction) : function; |
637 } | 618 } |
638 | 619 |
639 void addHiddenValueToArray(v8::Handle<v8::Object> object, v8::Local<v8::Value> v
alue, int arrayIndex, v8::Isolate* isolate) | 620 void addHiddenValueToArray(v8::Handle<v8::Object> object, v8::Local<v8::Value> v
alue, int arrayIndex, v8::Isolate* isolate) |
640 { | 621 { |
641 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); | 622 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); |
642 if (arrayValue->IsNull() || arrayValue->IsUndefined()) { | 623 if (arrayValue->IsNull() || arrayValue->IsUndefined()) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 V8BindingTestScope::V8BindingTestScope(v8::Isolate* isolate) | 680 V8BindingTestScope::V8BindingTestScope(v8::Isolate* isolate) |
700 : m_handleScope(isolate) | 681 : m_handleScope(isolate) |
701 , m_context(v8::Context::New(isolate)) | 682 , m_context(v8::Context::New(isolate)) |
702 , m_contextScope(m_context) | 683 , m_contextScope(m_context) |
703 , m_world(DOMWrapperWorld::create()) | 684 , m_world(DOMWrapperWorld::create()) |
704 , m_perContextData(V8PerContextData::create(m_context, m_world)) | 685 , m_perContextData(V8PerContextData::create(m_context, m_world)) |
705 { | 686 { |
706 } | 687 } |
707 | 688 |
708 } // namespace WebCore | 689 } // namespace WebCore |
OLD | NEW |