History

merge from upstream

Seth Alves committed 8 years ago

Commit 64a46bf2 parents 98e0e66 b97c938107 files · +1462 −601Browse files

Showing the changes to interface/src/Application.cpp (1 of 107 files). Show all

Unified · Split

interface/src/Application.cpp+32−5
@@ -68,6 +68,7 @@ · 67 unmodified lines
68#include <Midi.h>68#include <Midi.h>
69#include <AudioInjectorManager.h>69#include <AudioInjectorManager.h>
70#include <AvatarBookmarks.h>70#include <AvatarBookmarks.h>
71#include <AvatarEntitiesBookmarks.h>
71#include <CursorManager.h>72#include <CursorManager.h>
72#include <DebugDraw.h>73#include <DebugDraw.h>
73#include <DeferredLightingEffect.h>74#include <DeferredLightingEffect.h>
@@ -148,6 +149,7 @@ · 74 unmodified lines
148#include "avatar/AvatarManager.h"149#include "avatar/AvatarManager.h"
149#include "avatar/MyHead.h"150#include "avatar/MyHead.h"
150#include "CrashHandler.h"151#include "CrashHandler.h"
152#include "Crashpad.h"
151#include "devices/DdeFaceTracker.h"153#include "devices/DdeFaceTracker.h"
152#include "DiscoverabilityManager.h"154#include "DiscoverabilityManager.h"
153#include "GLCanvas.h"155#include "GLCanvas.h"
@@ -395,6 +397,7 @@ public: · 241 unmodified lines
395 setObjectName("Deadlock Watchdog");397 setObjectName("Deadlock Watchdog");
396 // Give the heartbeat an initial value398 // Give the heartbeat an initial value
397 _heartbeat = usecTimestampNow();399 _heartbeat = usecTimestampNow();
400 _paused = false;
398 connect(qApp, &QCoreApplication::aboutToQuit, [this] {401 connect(qApp, &QCoreApplication::aboutToQuit, [this] {
399 _quit = true;402 _quit = true;
400 });403 });
@@ -412,11 +415,20 @@ public: · 11 unmodified lines
412 *crashTrigger = 0xDEAD10CC;415 *crashTrigger = 0xDEAD10CC;
413 }416 }
414 417
418 static void pause() {
419 _paused = true;
420 }
421
422 static void resume() {
423 _paused = false;
424 updateHeartbeat();
425 }
426
415 void run() override {427 void run() override {
416 while (!_quit) {428 while (!_quit) {
417 QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS);429 QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS);
418 // Don't do heartbeat detection under nsight430 // Don't do heartbeat detection under nsight
419 if (nsightActive()) {431 if (nsightActive() || _paused) {
420 continue;432 continue;
421 }433 }
422 uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us434 uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us
@@ -472,6 +484,7 @@ public: · 49 unmodified lines
472 }484 }
473 }485 }
474 486
487 static std::atomic<bool> _paused;
475 static std::atomic<uint64_t> _heartbeat;488 static std::atomic<uint64_t> _heartbeat;
476 static std::atomic<uint64_t> _maxElapsed;489 static std::atomic<uint64_t> _maxElapsed;
477 static std::atomic<int> _maxElapsedAverage;490 static std::atomic<int> _maxElapsedAverage;
@@ -480,6 +493,7 @@ public: · 2 unmodified lines
480 bool _quit { false };493 bool _quit { false };
481};494};
482 495
496std::atomic<bool> DeadlockWatchdogThread::_paused;
483std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat;497std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat;
484std::atomic<uint64_t> DeadlockWatchdogThread::_maxElapsed;498std::atomic<uint64_t> DeadlockWatchdogThread::_maxElapsed;
485std::atomic<int> DeadlockWatchdogThread::_maxElapsedAverage;499std::atomic<int> DeadlockWatchdogThread::_maxElapsedAverage;
@@ -655,8 +669,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 169 unmodified lines
655 }669 }
656#endif670#endif
657 671
658 Setting::init();
659
660 // Tell the plugin manager about our statically linked plugins672 // Tell the plugin manager about our statically linked plugins
661 auto pluginManager = PluginManager::getInstance();673 auto pluginManager = PluginManager::getInstance();
662 pluginManager->setInputPluginProvider([] { return getInputPlugins(); });674 pluginManager->setInputPluginProvider([] { return getInputPlugins(); });
@@ -763,6 +775,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 100 unmodified lines
763 DependencyManager::set<GooglePolyScriptingInterface>();775 DependencyManager::set<GooglePolyScriptingInterface>();
764 DependencyManager::set<OctreeStatsProvider>(nullptr, qApp->getOcteeSceneStats());776 DependencyManager::set<OctreeStatsProvider>(nullptr, qApp->getOcteeSceneStats());
765 DependencyManager::set<AvatarBookmarks>();777 DependencyManager::set<AvatarBookmarks>();
778 DependencyManager::set<AvatarEntitiesBookmarks>();
766 DependencyManager::set<LocationBookmarks>();779 DependencyManager::set<LocationBookmarks>();
767 DependencyManager::set<Snapshot>();780 DependencyManager::set<Snapshot>();
768 DependencyManager::set<CloseEventSender>();781 DependencyManager::set<CloseEventSender>();
@@ -907,6 +920,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 138 unmodified lines
907 920
908 _logger->setSessionID(accountManager->getSessionID());921 _logger->setSessionID(accountManager->getSessionID());
909 922
923 setCrashAnnotation("metaverse_session_id", accountManager->getSessionID().toString().toStdString());
924
910 if (steamClient) {925 if (steamClient) {
911 qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();926 qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
912 }927 }
@@ -1906,7 +1921,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 993 unmodified lines
1906 entityResult.distance = pickResult->distance;1921 entityResult.distance = pickResult->distance;
1907 entityResult.surfaceNormal = pickResult->surfaceNormal;1922 entityResult.surfaceNormal = pickResult->surfaceNormal;
1908 entityResult.entityID = pickResult->objectID;1923 entityResult.entityID = pickResult->objectID;
1909 entityResult.entity = DependencyManager::get<EntityTreeRenderer>()->getTree()->findEntityByID(entityResult.entityID);1924 entityResult.extraInfo = pickResult->extraInfo;
1910 }1925 }
1911 }1926 }
1912 return entityResult;1927 return entityResult;
@@ -2267,6 +2282,11 @@ void Application::initializeGL() { · 354 unmodified lines
2267 initDisplay();2282 initDisplay();
2268 qCDebug(interfaceapp, "Initialized Display.");2283 qCDebug(interfaceapp, "Initialized Display.");
2269 2284
2285#ifdef Q_OS_OSX
2286 // FIXME: on mac os the shaders take up to 1 minute to compile, so we pause the deadlock watchdog thread.
2287 DeadlockWatchdogThread::pause();
2288#endif
2289
2270 // Set up the render engine2290 // Set up the render engine
2271 render::CullFunctor cullFunctor = LODManager::shouldRender;2291 render::CullFunctor cullFunctor = LODManager::shouldRender;
2272 static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";2292 static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
@@ -2275,6 +2295,11 @@ void Application::initializeGL() { · 2 unmodified lines
2275 _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);2295 _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);
2276#endif2296#endif
2277 _renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::TAG_BITS_0, render::ItemKey::TAG_BITS_0);2297 _renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::TAG_BITS_0, render::ItemKey::TAG_BITS_0);
2298
2299#ifdef Q_OS_OSX
2300 DeadlockWatchdogThread::resume();
2301#endif
2302
2278 _renderEngine->load();2303 _renderEngine->load();
2279 _renderEngine->registerScene(_main3DScene);2304 _renderEngine->registerScene(_main3DScene);
2280 2305
@@ -2443,6 +2468,7 @@ void Application::initializeUi() { · 162 unmodified lines
2443 surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());2468 surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
2444 surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());2469 surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
2445 surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());2470 surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
2471 surfaceContext->setContextProperty("AvatarEntitiesBookmarks", DependencyManager::get<AvatarEntitiesBookmarks>().data());
2446 surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());2472 surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());
2447 2473
2448 // Caches2474 // Caches
@@ -5851,6 +5877,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 3402 unmodified lines
5851 scriptEngine->registerGlobalObject("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());5877 scriptEngine->registerGlobalObject("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
5852 scriptEngine->registerGlobalObject("AudioScope", DependencyManager::get<AudioScope>().data());5878 scriptEngine->registerGlobalObject("AudioScope", DependencyManager::get<AudioScope>().data());
5853 scriptEngine->registerGlobalObject("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());5879 scriptEngine->registerGlobalObject("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
5880 scriptEngine->registerGlobalObject("AvatarEntitiesBookmarks", DependencyManager::get<AvatarEntitiesBookmarks>().data());
5854 scriptEngine->registerGlobalObject("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());5881 scriptEngine->registerGlobalObject("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());
5855 5882
5856 scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickScriptingInterface>().data());5883 scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickScriptingInterface>().data());
@@ -6268,7 +6295,7 @@ void Application::showAssetServerWidget(QString filePath) { · 411 unmodified lines
6268 if (!hmd->getShouldShowTablet() && !isHMDMode()) {6295 if (!hmd->getShouldShowTablet() && !isHMDMode()) {
6269 DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload);6296 DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload);
6270 } else {6297 } else {
6271 static const QUrl url("../dialogs/TabletAssetServer.qml");6298 static const QUrl url("hifi/dialogs/TabletAssetServer.qml");
6272 tablet->pushOntoStack(url);6299 tablet->pushOntoStack(url);
6273 }6300 }
6274 }6301 }