Exemplo n.º 1
0
HRESULT
MetroApp::OnResuming(IInspectable* aSender, IInspectable* aArgs)
{
  LogThread();
  PostSuspendResumeProcessNotification(false);
  return S_OK;
}
Exemplo n.º 2
0
// called after FrameworkView::Run() drops into the event dispatch loop
void
MetroApp::Initialize()
{
  HRESULT hr;
  LogThread();

  static bool xpcomInit;
  if (!xpcomInit) {
    xpcomInit = true;
    Log(L"XPCOM startup initialization began");
    nsresult rv = XRE_metroStartup();
    Log(L"XPCOM startup initialization complete");
    if (NS_FAILED(rv)) {
      Log(L"XPCOM startup initialization failed, bailing. rv=%X", rv);
      CoreExit();
      return;
    }
  }

  sFrameworkView->SetupContracts();

  hr = sCoreApp->add_Suspending(Callback<__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs_t>(
    this, &MetroApp::OnSuspending).Get(), &mSuspendEvent);
  AssertHRESULT(hr);

  hr = sCoreApp->add_Resuming(Callback<__FIEventHandler_1_IInspectable_t>(
    this, &MetroApp::OnResuming).Get(), &mResumeEvent);
  AssertHRESULT(hr);

  mozilla::widget::StartAudioSession();
}
Exemplo n.º 3
0
HRESULT
MetroApp::OnSuspending(IInspectable* aSender, ISuspendingEventArgs* aArgs)
{
  LogThread();
  PostSuspendResumeProcessNotification(true);
  return S_OK;
}
Exemplo n.º 4
0
void
MetroApp::Run()
{
  LogThread();

  // Name this thread for debugging and register it with the profiler
  // as the main gecko thread.
  char aLocal;
  PR_SetCurrentThreadName(gGeckoThreadName);
  profiler_register_thread(gGeckoThreadName, &aLocal);

  HRESULT hr;
  hr = sCoreApp->add_Suspending(Callback<__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs_t>(
    this, &MetroApp::OnSuspending).Get(), &mSuspendEvent);
  AssertHRESULT(hr);

  hr = sCoreApp->add_Resuming(Callback<__FIEventHandler_1_IInspectable_t>(
    this, &MetroApp::OnResuming).Get(), &mResumeEvent);
  AssertHRESULT(hr);

  Log("XPCOM startup initialization began");
  nsresult rv = XRE_metroStartup(true);
  Log("XPCOM startup initialization complete");
  if (NS_FAILED(rv)) {
    Log("XPCOM startup initialization failed, bailing. rv=%X", rv);
    CoreExit();
  }
}
Exemplo n.º 5
0
// static
void
MetroApp::SetBaseWidget(MetroWidget* aPtr)
{
  LogThread();
  NS_ASSERTION(aPtr, "setting null base widget?");
  aPtr->SetView(sFrameworkView.Get());
  sFrameworkView->SetWidget(aPtr);
}
Exemplo n.º 6
0
// static
void
MetroApp::SetBaseWidget(MetroWidget* aPtr)
{
  LogThread();

  NS_ASSERTION(aPtr, "setting null base widget?");

  // Both of these calls AddRef the ptr we pass in
  aPtr->SetView(sFrameworkView.Get());
  sFrameworkView->SetWidget(aPtr);
}
Exemplo n.º 7
0
// Free all xpcom related resources before calling the xre shutdown call.
// Must be called on the metro main thread. Currently called from appshell.
void
MetroApp::ShutdownXPCOM()
{
  LogThread();

  mozilla::widget::StopAudioSession();

  sCoreApp->remove_Suspending(mSuspendEvent);
  sCoreApp->remove_Resuming(mResumeEvent);

  MetroApp::GetView()->ShutdownXPCOM();

  // Shut down xpcom
  XRE_metroShutdown();
}
Exemplo n.º 8
0
// Free all xpcom related resources before calling the xre shutdown call.
// Must be called on the metro main thread. Currently called from appshell.
void
MetroApp::ShutdownXPCOM()
{
  LogThread();

  if (sCoreApp) {
    sCoreApp->remove_Suspending(mSuspendEvent);
    sCoreApp->remove_Resuming(mResumeEvent);
  }

  if (sFrameworkView) {
    sFrameworkView->ShutdownXPCOM();
  }

  // Shut down xpcom
  XRE_metroShutdown();

  // Unhook this thread from the profiler
  profiler_unregister_thread();
}