nsAndroidBridge::nsAndroidBridge() { RefPtr<widget::EventDispatcher> dispatcher = new widget::EventDispatcher(); dispatcher->Attach(java::EventDispatcher::GetInstance(), /* window */ nullptr); mEventDispatcher = dispatcher; AddObservers(); }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- AudioPlayer* DirectMusicAudioDevice::CreateAudioPlayer(AudioStream* source, bool enable3d, SoundPlayType type) { RefPtr<DirectMusicAudioPlayer> audioPlayer; if (type == SoundPlayType_Midi) { LN_THROW(DirectMusicManager::GetInstance(), InvalidOperationException); audioPlayer.Attach(LN_NEW DirectMusicAudioPlayer(this), false); audioPlayer->Initialize(source, enable3d); } audioPlayer.SafeAddRef(); return audioPlayer; }
/* static */ already_AddRefed<BrowsingContext> BrowsingContext::Create( BrowsingContext* aParent, BrowsingContext* aOpener, const nsAString& aName, Type aType) { MOZ_DIAGNOSTIC_ASSERT(!aParent || aParent->mType == aType); uint64_t id = nsContentUtils::GenerateBrowsingContextId(); MOZ_LOG(GetLog(), LogLevel::Debug, ("Creating 0x%08" PRIx64 " in %s", id, XRE_IsParentProcess() ? "Parent" : "Child")); // Determine which BrowsingContextGroup this context should be created in. RefPtr<BrowsingContextGroup> group = BrowsingContextGroup::Select(aParent, aOpener); RefPtr<BrowsingContext> context; if (XRE_IsParentProcess()) { context = new CanonicalBrowsingContext(aParent, group, id, /* aProcessId */ 0, aType); } else { context = new BrowsingContext(aParent, group, id, aType); } // The name and opener fields need to be explicitly initialized. Don't bother // using transactions to set them, as we haven't been attached yet. context->mName = aName; context->mOpenerId = aOpener ? aOpener->Id() : 0; if (aParent) { context->mCrossOriginPolicy = aParent->mCrossOriginPolicy; } else if (aOpener) { context->mCrossOriginPolicy = aOpener->mCrossOriginPolicy; } else { context->mCrossOriginPolicy = nsILoadInfo::CROSS_ORIGIN_POLICY_NULL; } Register(context); // Attach the browsing context to the tree. context->Attach(); return context.forget(); }
RefPtr<Type> Parser::ParseBasicType() { RefPtr<Type> type; RefPtr<TypeQualified> tid; switch ( GetTokenCode() ) { case TOKidentifier: tid = ParseTypeName( NULL ); type.Attach( tid.Detach() ); break; case TOKdot: tid = new TypeIdentifier( mScanner->GetNameTable()->GetEmpty() ); tid = ParseTypeName( tid.Get() ); type.Attach( tid.Detach() ); break; case TOKtypeof: tid = ParseTypeof(); if ( GetTokenCode() == TOKdot ) { NextToken(); tid = ParseTypeName( tid.Get() ); } type.Attach( tid.Detach() ); break; case TOKconst: // const(type) NextToken(); Match( TOKlparen ); type = ParseType(); Match( TOKrparen ); if ( type->IsShared() ) type = type->MakeSharedConst(); else type = type->MakeConst(); break; case TOKinvariant: case TOKimmutable: // invariant(type) NextToken(); Match( TOKlparen ); type = ParseType(); Match( TOKrparen ); type = type->MakeInvariant(); break; case TOKshared: // shared(type) NextToken(); Match( TOKlparen ); type = ParseType(); Match( TOKrparen ); if ( type->IsConst() ) type = type->MakeSharedConst(); else type = type->MakeShared(); break; default: type = FindBasicType( GetTokenCode() ); if ( type == NULL ) throw 25; NextToken(); break; } return type; }