コード例 #1
0
TabContentsContainer::~TabContentsContainer()
{
    if(tab_contents_)
    {
        RemoveObservers();
    }
}
コード例 #2
0
void
nsCategoryObserver::ListenerDied()
{
  MOZ_ASSERT(NS_IsMainThread());
  RemoveObservers();
  mCallback = nullptr;
  mClosure = nullptr;
}
コード例 #3
0
NS_IMETHODIMP
nsCategoryObserver::Observe(nsISupports* aSubject, const char* aTopic,
                            const PRUnichar* aData) {
  if (!mListener)
    return NS_OK;

  if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
    mHash.Clear();
    mListener->CategoryCleared();
    RemoveObservers();

    return NS_OK;
  }

  if (!aData ||
      !nsDependentString(aData).Equals(NS_ConvertASCIItoUTF16(mCategory)))
    return NS_OK;

  nsCAutoString str;
  nsCOMPtr<nsISupportsCString> strWrapper(do_QueryInterface(aSubject));
  if (strWrapper)
    strWrapper->GetData(str);

  if (strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID) == 0) {
    // We may get an add notification even when we already have an entry. This
    // is due to the notification happening asynchronously, so if the entry gets
    // added and an nsCategoryObserver gets instantiated before events get
    // processed, we'd get the notification for an existing entry.
    // Do nothing in that case.
    if (mHash.Get(str, nullptr))
      return NS_OK;

    nsCOMPtr<nsICategoryManager> catMan =
      do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
    if (!catMan)
      return NS_OK;

    nsCString entryValue;
    catMan->GetCategoryEntry(mCategory.get(),
                             str.get(),
                             getter_Copies(entryValue));

    mHash.Put(str, entryValue);
    mListener->EntryAdded(entryValue);
  } else if (strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID) == 0) {
    nsCAutoString val;
    if (mHash.Get(str, &val)) {
      mHash.Remove(str);
      mListener->EntryRemoved(val);
    }
  } else if (strcmp(aTopic, NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID) == 0) {
    mHash.Clear();
    mListener->CategoryCleared();
  }
  return NS_OK;
}
コード例 #4
0
nsresult
TimelineConsumers::Observe(nsISupports* aSubject,
                           const char* aTopic,
                           const char16_t* aData)
{
  if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
    sInShutdown = true;
    RemoveObservers();
    return NS_OK;
  }

  MOZ_ASSERT(false, "TimelineConsumers got unexpected topic!");
  return NS_ERROR_UNEXPECTED;
}
コード例 #5
0
void TabContentsContainer::ChangeTabContents(TabContents* contents)
{
    if(tab_contents_)
    {
        view::View *v = (tab_contents_->puttyView());
        tab_contents_->WasHidden();
        RemoveChildView(v);
        RemoveObservers();
    }
    tab_contents_ = contents;
    // When detaching the last tab of the browser ChangeTabContents is invoked
    // with NULL. Don't attempt to do anything in that case.
    if(tab_contents_)
    {
        view::View *v = (contents->puttyView());
        AddChildView(v);
        SetLayoutManager(new view::FillLayout());
        Layout();
        AddObservers();
		tab_contents_->ShowContents();
    }
}
コード例 #6
0
void
nsCategoryObserver::ListenerDied() {
  mListener = nullptr;
  RemoveObservers();
}
コード例 #7
0
ファイル: nsCategoryCache.cpp プロジェクト: afabbro/gecko-dev
void
nsCategoryObserver::ListenerDied() {
  RemoveObservers();
}