BsLinuxRenderWindow.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "CoreThread/BsCoreThread.h"
  4. #include "Private/Linux/BsLinuxPlatform.h"
  5. #include "Private/Linux/BsLinuxWindow.h"
  6. #include "Linux/BsLinuxRenderWindow.h"
  7. #include "Linux/BsLinuxVideoModeInfo.h"
  8. #include "Linux/BsLinuxGLSupport.h"
  9. #include "Linux/BsLinuxContext.h"
  10. #include "BsGLPixelFormat.h"
  11. #include "BsGLRenderWindowManager.h"
  12. #include "Math/BsMath.h"
  13. #define XRANDR_ROTATION_LEFT (1 << 1)
  14. #define XRANDR_ROTATION_RIGHT (1 << 3)
  15. namespace bs
  16. {
  17. LinuxRenderWindow::LinuxRenderWindow(const RENDER_WINDOW_DESC& desc, UINT32 windowId, ct::LinuxGLSupport& glSupport)
  18. :RenderWindow(desc, windowId), mGLSupport(glSupport), mProperties(desc)
  19. { }
  20. void LinuxRenderWindow::getCustomAttribute(const String& name, void* data) const
  21. {
  22. if (name == "WINDOW" || name == "LINUX_WINDOW")
  23. {
  24. blockUntilCoreInitialized();
  25. getCore()->getCustomAttribute(name, data);
  26. return;
  27. }
  28. }
  29. Vector2I LinuxRenderWindow::screenToWindowPos(const Vector2I& screenPos) const
  30. {
  31. blockUntilCoreInitialized();
  32. LinuxPlatform::lockX();
  33. Vector2I pos = getCore()->_getInternal()->screenToWindowPos(screenPos);
  34. LinuxPlatform::unlockX();
  35. return pos;
  36. }
  37. Vector2I LinuxRenderWindow::windowToScreenPos(const Vector2I& windowPos) const
  38. {
  39. blockUntilCoreInitialized();
  40. LinuxPlatform::lockX();
  41. Vector2I pos = getCore()->_getInternal()->windowToScreenPos(windowPos);
  42. LinuxPlatform::unlockX();
  43. return pos;
  44. }
  45. SPtr<ct::LinuxRenderWindow> LinuxRenderWindow::getCore() const
  46. {
  47. return std::static_pointer_cast<ct::LinuxRenderWindow>(mCoreSpecific);
  48. }
  49. void LinuxRenderWindow::syncProperties()
  50. {
  51. ScopedSpinLock lock(getCore()->_getPropertiesLock());
  52. mProperties = getCore()->mSyncedProperties;
  53. }
  54. namespace ct
  55. {
  56. LinuxRenderWindow::LinuxRenderWindow(const RENDER_WINDOW_DESC& desc, UINT32 windowId, LinuxGLSupport& glsupport)
  57. : RenderWindow(desc, windowId), mWindow(nullptr), mGLSupport(glsupport), mContext(nullptr), mProperties(desc)
  58. , mSyncedProperties(desc), mIsChild(false), mShowOnSwap(false)
  59. { }
  60. LinuxRenderWindow::~LinuxRenderWindow()
  61. {
  62. // Make sure to set the original desktop video mode before we exit
  63. if(mProperties.isFullScreen)
  64. setWindowed(50, 50);
  65. if (mWindow != nullptr)
  66. {
  67. Platform::resetNonClientAreas(*this);
  68. LinuxPlatform::lockX();
  69. bs_delete(mWindow);
  70. mWindow = nullptr;
  71. LinuxPlatform::unlockX();
  72. }
  73. }
  74. void LinuxRenderWindow::initialize()
  75. {
  76. LinuxPlatform::lockX();
  77. RenderWindowProperties& props = mProperties;
  78. props.isFullScreen = mDesc.fullscreen;
  79. mIsChild = false;
  80. GLVisualConfig visualConfig = mGLSupport.findBestVisual(LinuxPlatform::getXDisplay(), mDesc.depthBuffer,
  81. mDesc.multisampleCount, mDesc.gamma);
  82. WINDOW_DESC windowDesc;
  83. windowDesc.x = mDesc.left;
  84. windowDesc.y = mDesc.top;
  85. windowDesc.width = mDesc.videoMode.getWidth();
  86. windowDesc.height = mDesc.videoMode.getHeight();
  87. windowDesc.title = mDesc.title;
  88. windowDesc.showDecorations = mDesc.showTitleBar;
  89. windowDesc.allowResize = mDesc.allowResize;
  90. windowDesc.showOnTaskBar = !mDesc.toolWindow;
  91. windowDesc.modal = mDesc.modal;
  92. windowDesc.visualInfo = visualConfig.visualInfo;
  93. windowDesc.screen = mDesc.videoMode.getOutputIdx();
  94. windowDesc.hidden = mDesc.hideUntilSwap || mDesc.hidden;
  95. NameValuePairList::const_iterator opt;
  96. opt = mDesc.platformSpecific.find("parentWindowHandle");
  97. if (opt != mDesc.platformSpecific.end())
  98. windowDesc.parent = (::Window)parseUINT64(opt->second);
  99. else
  100. windowDesc.parent = 0;
  101. mIsChild = windowDesc.parent != 0;
  102. props.isFullScreen = mDesc.fullscreen && !mIsChild;
  103. mShowOnSwap = mDesc.hideUntilSwap;
  104. props.isHidden = mDesc.hideUntilSwap || mDesc.hidden;
  105. mWindow = bs_new<LinuxWindow>(windowDesc);
  106. mWindow->_setUserData(this);
  107. props.width = mWindow->getWidth();
  108. props.height = mWindow->getHeight();
  109. props.top = mWindow->getTop();
  110. props.left = mWindow->getLeft();
  111. props.hwGamma = visualConfig.caps.srgb;
  112. props.multisampleCount = visualConfig.caps.numSamples;
  113. XWindowAttributes windowAttributes;
  114. XGetWindowAttributes(LinuxPlatform::getXDisplay(), mWindow->_getXWindow(), &windowAttributes);
  115. XVisualInfo requestVI;
  116. requestVI.screen = windowDesc.screen;
  117. requestVI.visualid = XVisualIDFromVisual(windowAttributes.visual);
  118. LinuxPlatform::unlockX(); // Calls below have their own locking mechanisms
  119. mContext = mGLSupport.createContext(LinuxPlatform::getXDisplay(), requestVI);
  120. if(mDesc.fullscreen && !mIsChild)
  121. setFullscreen(mDesc.videoMode);
  122. if(mDesc.vsync && mDesc.vsyncInterval > 0)
  123. setVSync(true, mDesc.vsyncInterval);
  124. {
  125. ScopedSpinLock lock(mLock);
  126. mSyncedProperties = props;
  127. }
  128. bs::RenderWindowManager::instance().notifySyncDataDirty(this);
  129. RenderWindow::initialize();
  130. }
  131. void LinuxRenderWindow::setFullscreen(UINT32 width, UINT32 height, float refreshRate, UINT32 monitorIdx)
  132. {
  133. THROW_IF_NOT_CORE_THREAD;
  134. VideoMode videoMode(width, height, refreshRate, monitorIdx);
  135. setFullscreen(videoMode);
  136. }
  137. void LinuxRenderWindow::setVideoMode(INT32 screen, RROutput output, RRMode mode)
  138. {
  139. ::Display* display = LinuxPlatform::getXDisplay();
  140. ::Window rootWindow = RootWindow(display, screen);
  141. XRRScreenResources* screenRes = XRRGetScreenResources (display, rootWindow);
  142. if(screenRes == nullptr)
  143. {
  144. LOGERR("XRR: Failed to retrieve screen resources. ");
  145. return;
  146. }
  147. XRROutputInfo* outputInfo = XRRGetOutputInfo(display, screenRes, output);
  148. if(outputInfo == nullptr)
  149. {
  150. XRRFreeScreenResources(screenRes);
  151. LOGERR("XRR: Failed to retrieve output info for output: " + toString((UINT32)output));
  152. return;
  153. }
  154. XRRCrtcInfo* crtcInfo = XRRGetCrtcInfo(display, screenRes, outputInfo->crtc);
  155. if(crtcInfo == nullptr)
  156. {
  157. XRRFreeScreenResources(screenRes);
  158. XRRFreeOutputInfo(outputInfo);
  159. LOGERR("XRR: Failed to retrieve CRTC info for output: " + toString((UINT32)output));
  160. return;
  161. }
  162. // Note: This changes the user's desktop resolution permanently, even when the app exists, make sure to revert
  163. // (Sadly there doesn't appear to be a better way)
  164. Status status = XRRSetCrtcConfig (display, screenRes, outputInfo->crtc, CurrentTime,
  165. crtcInfo->x, crtcInfo->y, mode, crtcInfo->rotation, &output, 1);
  166. if(status != Success)
  167. LOGERR("XRR: XRRSetCrtcConfig failed.");
  168. XRRFreeCrtcInfo(crtcInfo);
  169. XRRFreeOutputInfo(outputInfo);
  170. XRRFreeScreenResources(screenRes);
  171. }
  172. void LinuxRenderWindow::setFullscreen(const VideoMode& mode)
  173. {
  174. THROW_IF_NOT_CORE_THREAD;
  175. if (mIsChild)
  176. return;
  177. const LinuxVideoModeInfo& videoModeInfo =
  178. static_cast<const LinuxVideoModeInfo&>(RenderAPI::instance().getVideoModeInfo());
  179. UINT32 outputIdx = mode.getOutputIdx();
  180. if(outputIdx >= videoModeInfo.getNumOutputs())
  181. {
  182. LOGERR("Invalid output device index.")
  183. return;
  184. }
  185. const LinuxVideoOutputInfo& outputInfo =
  186. static_cast<const LinuxVideoOutputInfo&>(videoModeInfo.getOutputInfo (outputIdx));
  187. INT32 screen = outputInfo._getScreen();
  188. RROutput outputID = outputInfo._getOutputID();
  189. RRMode modeID = 0;
  190. if(!mode.isCustom())
  191. {
  192. const LinuxVideoMode& videoMode = static_cast<const LinuxVideoMode&>(mode);
  193. modeID = videoMode._getModeID();
  194. }
  195. else
  196. {
  197. LinuxPlatform::lockX();
  198. // Look for mode matching the requested resolution
  199. ::Display* display = LinuxPlatform::getXDisplay();
  200. ::Window rootWindow = RootWindow(display, screen);
  201. XRRScreenResources* screenRes = XRRGetScreenResources(display, rootWindow);
  202. if (screenRes == nullptr)
  203. {
  204. LOGERR("XRR: Failed to retrieve screen resources. ");
  205. return;
  206. }
  207. XRROutputInfo* outputInfo = XRRGetOutputInfo(display, screenRes, outputID);
  208. if (outputInfo == nullptr)
  209. {
  210. XRRFreeScreenResources(screenRes);
  211. LOGERR("XRR: Failed to retrieve output info for output: " + toString((UINT32)outputID));
  212. return;
  213. }
  214. XRRCrtcInfo* crtcInfo = XRRGetCrtcInfo(display, screenRes, outputInfo->crtc);
  215. if (crtcInfo == nullptr)
  216. {
  217. XRRFreeScreenResources(screenRes);
  218. XRRFreeOutputInfo(outputInfo);
  219. LOGERR("XRR: Failed to retrieve CRTC info for output: " + toString((UINT32)outputID));
  220. return;
  221. }
  222. bool foundMode = false;
  223. for (INT32 i = 0; i < screenRes->nmode; i++)
  224. {
  225. const XRRModeInfo& modeInfo = screenRes->modes[i];
  226. UINT32 width, height;
  227. if (crtcInfo->rotation & (XRANDR_ROTATION_LEFT | XRANDR_ROTATION_RIGHT))
  228. {
  229. width = modeInfo.height;
  230. height = modeInfo.width;
  231. }
  232. else
  233. {
  234. width = modeInfo.width;
  235. height = modeInfo.height;
  236. }
  237. float refreshRate;
  238. if (modeInfo.hTotal != 0 && modeInfo.vTotal != 0)
  239. refreshRate = (float) (modeInfo.dotClock / (double) (modeInfo.hTotal * modeInfo.vTotal));
  240. else
  241. refreshRate = 0.0f;
  242. if (width == mode.getWidth() && height == mode.getHeight())
  243. {
  244. modeID = modeInfo.id;
  245. foundMode = true;
  246. if (Math::approxEquals(refreshRate, mode.getRefreshRate()))
  247. break;
  248. }
  249. }
  250. if (!foundMode)
  251. {
  252. LinuxPlatform::unlockX();
  253. LOGERR("Unable to enter fullscreen, unsupported video mode requested.");
  254. return;
  255. }
  256. LinuxPlatform::unlockX();
  257. }
  258. LinuxPlatform::lockX();
  259. setVideoMode(screen, outputID, modeID);
  260. mWindow->_setFullscreen(true);
  261. LinuxPlatform::unlockX();
  262. RenderWindowProperties& props = mProperties;
  263. props.isFullScreen = true;
  264. props.top = 0;
  265. props.left = 0;
  266. props.width = mode.getWidth();
  267. props.height = mode.getHeight();
  268. _windowMovedOrResized();
  269. {
  270. ScopedSpinLock lock(mLock);
  271. mSyncedProperties.left = props.left;
  272. mSyncedProperties.top = props.top;
  273. mSyncedProperties.width = props.width;
  274. mSyncedProperties.height = props.height;
  275. }
  276. bs::RenderWindowManager::instance().notifySyncDataDirty(this);
  277. bs::RenderWindowManager::instance().notifyMovedOrResized(this);
  278. }
  279. void LinuxRenderWindow::setWindowed(UINT32 width, UINT32 height)
  280. {
  281. THROW_IF_NOT_CORE_THREAD;
  282. RenderWindowProperties& props = mProperties;
  283. if (!props.isFullScreen)
  284. return;
  285. // Restore old screen config
  286. const LinuxVideoModeInfo& videoModeInfo =
  287. static_cast<const LinuxVideoModeInfo&>(RenderAPI::instance().getVideoModeInfo());
  288. UINT32 outputIdx = 0; // 0 is always primary
  289. if(outputIdx >= videoModeInfo.getNumOutputs())
  290. {
  291. LOGERR("Invalid output device index.")
  292. return;
  293. }
  294. const LinuxVideoOutputInfo& outputInfo =
  295. static_cast<const LinuxVideoOutputInfo&>(videoModeInfo.getOutputInfo (outputIdx));
  296. const LinuxVideoMode& desktopVideoMode = static_cast<const LinuxVideoMode&>(outputInfo.getDesktopVideoMode());
  297. LinuxPlatform::lockX();
  298. setVideoMode(outputInfo._getScreen(), outputInfo._getOutputID(), desktopVideoMode._getModeID());
  299. mWindow->_setFullscreen(false);
  300. LinuxPlatform::unlockX();
  301. props.isFullScreen = false;
  302. props.width = width;
  303. props.height = height;
  304. _windowMovedOrResized();
  305. {
  306. ScopedSpinLock lock(mLock);
  307. mSyncedProperties.left = props.left;
  308. mSyncedProperties.top = props.top;
  309. mSyncedProperties.width = props.width;
  310. mSyncedProperties.height = props.height;
  311. }
  312. bs::RenderWindowManager::instance().notifySyncDataDirty(this);
  313. bs::RenderWindowManager::instance().notifyMovedOrResized(this);
  314. }
  315. void LinuxRenderWindow::move(INT32 left, INT32 top)
  316. {
  317. THROW_IF_NOT_CORE_THREAD;
  318. RenderWindowProperties& props = mProperties;
  319. if (!props.isFullScreen)
  320. {
  321. LinuxPlatform::lockX();
  322. mWindow->move(left, top);
  323. LinuxPlatform::unlockX();
  324. props.top = mWindow->getTop();
  325. props.left = mWindow->getLeft();
  326. {
  327. ScopedSpinLock lock(mLock);
  328. mSyncedProperties.top = props.top;
  329. mSyncedProperties.left = props.left;
  330. }
  331. bs::RenderWindowManager::instance().notifySyncDataDirty(this);
  332. }
  333. }
  334. void LinuxRenderWindow::resize(UINT32 width, UINT32 height)
  335. {
  336. THROW_IF_NOT_CORE_THREAD;
  337. RenderWindowProperties& props = mProperties;
  338. if (!props.isFullScreen)
  339. {
  340. LinuxPlatform::lockX();
  341. mWindow->resize(width, height);
  342. LinuxPlatform::unlockX();
  343. props.width = mWindow->getWidth();
  344. props.height = mWindow->getHeight();
  345. {
  346. ScopedSpinLock lock(mLock);
  347. mSyncedProperties.width = props.width;
  348. mSyncedProperties.height = props.height;
  349. }
  350. bs::RenderWindowManager::instance().notifySyncDataDirty(this);
  351. }
  352. }
  353. void LinuxRenderWindow::minimize()
  354. {
  355. THROW_IF_NOT_CORE_THREAD;
  356. LinuxPlatform::lockX();
  357. mWindow->minimize();
  358. LinuxPlatform::unlockX();
  359. }
  360. void LinuxRenderWindow::maximize()
  361. {
  362. THROW_IF_NOT_CORE_THREAD;
  363. LinuxPlatform::lockX();
  364. mWindow->maximize();
  365. LinuxPlatform::unlockX();
  366. }
  367. void LinuxRenderWindow::restore()
  368. {
  369. THROW_IF_NOT_CORE_THREAD;
  370. LinuxPlatform::lockX();
  371. mWindow->restore();
  372. LinuxPlatform::unlockX();
  373. }
  374. void LinuxRenderWindow::setVSync(bool enabled, UINT32 interval)
  375. {
  376. THROW_IF_NOT_CORE_THREAD;
  377. if(!enabled)
  378. interval = 0;
  379. LinuxPlatform::lockX();
  380. if(glXSwapIntervalEXT != nullptr)
  381. glXSwapIntervalEXT(LinuxPlatform::getXDisplay(), mWindow->_getXWindow(), interval);
  382. else if(glXSwapIntervalMESA != nullptr)
  383. glXSwapIntervalMESA(interval);
  384. else if(glXSwapIntervalSGI != nullptr)
  385. glXSwapIntervalSGI(interval);
  386. LinuxPlatform::unlockX();
  387. mProperties.vsync = enabled;
  388. mProperties.vsyncInterval = interval;
  389. {
  390. ScopedSpinLock lock(mLock);
  391. mSyncedProperties.vsync = enabled;
  392. mSyncedProperties.vsyncInterval = interval;
  393. }
  394. bs::RenderWindowManager::instance().notifySyncDataDirty(this);
  395. }
  396. void LinuxRenderWindow::swapBuffers(UINT32 syncMask)
  397. {
  398. THROW_IF_NOT_CORE_THREAD;
  399. if (mShowOnSwap)
  400. setHidden(false);
  401. LinuxPlatform::lockX();
  402. glXSwapBuffers(LinuxPlatform::getXDisplay(), mWindow->_getXWindow());
  403. LinuxPlatform::unlockX();
  404. }
  405. void LinuxRenderWindow::copyToMemory(PixelData &dst, FrameBuffer buffer)
  406. {
  407. THROW_IF_NOT_CORE_THREAD;
  408. if ((dst.getRight() > getProperties().width) ||
  409. (dst.getBottom() > getProperties().height) ||
  410. (dst.getFront() != 0) || (dst.getBack() != 1))
  411. {
  412. BS_EXCEPT(InvalidParametersException, "Invalid box.");
  413. }
  414. if (buffer == FB_AUTO)
  415. {
  416. buffer = mProperties.isFullScreen ? FB_FRONT : FB_BACK;
  417. }
  418. GLenum format = GLPixelUtil::getGLOriginFormat(dst.getFormat());
  419. GLenum type = GLPixelUtil::getGLOriginDataType(dst.getFormat());
  420. if ((format == GL_NONE) || (type == 0))
  421. {
  422. BS_EXCEPT(InvalidParametersException, "Unsupported format.");
  423. }
  424. // Must change the packing to ensure no overruns!
  425. glPixelStorei(GL_PACK_ALIGNMENT, 1);
  426. glReadBuffer((buffer == FB_FRONT)? GL_FRONT : GL_BACK);
  427. glReadPixels((GLint)dst.getLeft(), (GLint)dst.getTop(),
  428. (GLsizei)dst.getWidth(), (GLsizei)dst.getHeight(),
  429. format, type, dst.getData());
  430. // restore default alignment
  431. glPixelStorei(GL_PACK_ALIGNMENT, 4);
  432. //vertical flip
  433. {
  434. size_t rowSpan = dst.getWidth() * PixelUtil::getNumElemBytes(dst.getFormat());
  435. size_t height = dst.getHeight();
  436. UINT8* tmpData = (UINT8*)bs_alloc((UINT32)(rowSpan * height));
  437. UINT8* srcRow = (UINT8 *)dst.getData(), *tmpRow = tmpData + (height - 1) * rowSpan;
  438. while (tmpRow >= tmpData)
  439. {
  440. memcpy(tmpRow, srcRow, rowSpan);
  441. srcRow += rowSpan;
  442. tmpRow -= rowSpan;
  443. }
  444. memcpy(dst.getData(), tmpData, rowSpan * height);
  445. bs_free(tmpData);
  446. }
  447. }
  448. void LinuxRenderWindow::getCustomAttribute(const String& name, void* data) const
  449. {
  450. if(name == "GLCONTEXT")
  451. {
  452. SPtr<GLContext>* contextPtr = static_cast<SPtr<GLContext>*>(data);
  453. *contextPtr = mContext;
  454. return;
  455. }
  456. else if(name == "LINUX_WINDOW")
  457. {
  458. LinuxWindow** window = (LinuxWindow**)data;
  459. *window = mWindow;
  460. return;
  461. }
  462. else if(name == "WINDOW")
  463. {
  464. ::Window* window = (::Window*)data;
  465. *window = mWindow->_getXWindow();
  466. return;
  467. }
  468. }
  469. void LinuxRenderWindow::setActive(bool state)
  470. {
  471. THROW_IF_NOT_CORE_THREAD;
  472. LinuxPlatform::lockX();
  473. if(state)
  474. mWindow->restore();
  475. else
  476. mWindow->minimize();
  477. LinuxPlatform::unlockX();
  478. RenderWindow::setActive(state);
  479. }
  480. void LinuxRenderWindow::setHidden(bool hidden)
  481. {
  482. THROW_IF_NOT_CORE_THREAD;
  483. if(!hidden)
  484. mShowOnSwap = false;
  485. LinuxPlatform::lockX();
  486. if(hidden)
  487. mWindow->hide();
  488. else
  489. mWindow->show();
  490. LinuxPlatform::unlockX();
  491. RenderWindow::setHidden(hidden);
  492. }
  493. void LinuxRenderWindow::_windowMovedOrResized()
  494. {
  495. if (!mWindow)
  496. return;
  497. RenderWindowProperties& props = mProperties;
  498. if (!props.isFullScreen) // Fullscreen is handled directly by this object
  499. {
  500. props.top = mWindow->getTop();
  501. props.left = mWindow->getLeft();
  502. props.width = mWindow->getWidth();
  503. props.height = mWindow->getHeight();
  504. }
  505. }
  506. void LinuxRenderWindow::syncProperties()
  507. {
  508. ScopedSpinLock lock(mLock);
  509. mProperties = mSyncedProperties;
  510. }
  511. }}