int SearObject::shutdown() { assert(m_initialised == true); // Clean up OpenGL bits contextDestroyed(true); StaticObjectList::const_iterator I = m_static_objects.begin(); StaticObjectList::const_iterator Iend = m_static_objects.end(); for (; I != Iend; ++I) { StaticObject* so = *I; assert(so); int id, mask_id; // Clean up textures if (so->getTexture(0, id, mask_id) == 0) { RenderSystem::getInstance().releaseTexture(id); RenderSystem::getInstance().releaseTexture(mask_id); } delete so; } m_static_objects.clear(); m_initialised = false; return 0; }
HRESULT STDMETHODCALLTYPE CrossfireServer::contextCreated(DWORD processId, DWORD threadId, OLECHAR* url) { if (!isConnected()) { return S_FALSE; } /* * When navigating from one page to another, a script node is initialized for the * new page before notification of the navigation is received. As a result this * first script node for the new page becomes associated with the context of the * old page. The workaround for this is to detect the case of a page re-navigation * within a given process and copy the last initialized script node to the newly- * created context. */ IDebugApplicationNode* scriptNode = NULL; /* If there's already a context for the specified processId then destroy it */ std::map<DWORD, CrossfireContext*>::iterator iterator = m_contexts->find(processId); if (iterator != m_contexts->end()) { scriptNode = iterator->second->getLastInitializedScriptNode(); if (scriptNode) { scriptNode->AddRef(); } contextDestroyed(processId); } CrossfireContext* context = new CrossfireContext(processId, threadId, url, this); m_contexts->insert(std::pair<DWORD,CrossfireContext*> (processId, context)); if (scriptNode) { context->scriptInitialized(scriptNode, true); scriptNode->Release(); } eventContextCreated(context); /* * Attempt to detect the case of the user not launching IE as the Administrator user, and * display an error message if appropriate. Do not show the error more than once, and do * not show it for the about:blank page, because IE's initial about:blank page fails to * provide a remote debug thread even when IE is launched as the Administrator user. */ if (!m_connectionWarningShown && wcscmp(url, ABOUT_BLANK) != 0) { CComPtr<IRemoteDebugApplication> application = NULL; if (!context->getDebugApplication(&application)) { DWORD processId = context->getProcessId(); IBrowserContext* listener = m_browsers->at(processId); if (!listener) { Logger::error("CrossfireServer.contextCreated(): the specified processId is not listening to the server"); } else { if (SUCCEEDED(listener->displayMessage(L"Crossfire Server for Internet Explorer failed to connect to the loaded page, so this page and possibly subsequent ones will not be debuggable. A common cause of this problem is launching Internet Explorer as a user other than the Administrator."))) { m_connectionWarningShown = true; } } } } return S_OK; }
void SuspendableObject::didMoveToNewExecutionContext( ExecutionContext* context) { setContext(context); if (context->isContextDestroyed()) { contextDestroyed(); return; } if (context->activeDOMObjectsAreSuspended()) { suspend(); return; } resume(); }
InProcessWorkerMessagingProxyForTest(ExecutionContext* executionContext, BlinkGC::ThreadHeapMode threadHeapMode) : InProcessWorkerMessagingProxy(executionContext, nullptr /* workerObject */, nullptr /* workerClients */) { workerObjectProxy().m_defaultIntervalInSec = kDefaultIntervalInSec; workerObjectProxy().m_nextIntervalInSec = kNextIntervalInSec; workerObjectProxy().m_maxIntervalInSec = kMaxIntervalInSec; m_mockWorkerLoaderProxyProvider = wrapUnique(new MockWorkerLoaderProxyProvider()); m_workerThread = wrapUnique( new DedicatedWorkerThreadForTest(m_mockWorkerLoaderProxyProvider.get(), workerObjectProxy(), threadHeapMode)); workerThreadCreated(); m_mockWorkerThreadLifecycleObserver = new MockWorkerThreadLifecycleObserver( m_workerThread->getWorkerThreadLifecycleContext()); EXPECT_CALL(*m_mockWorkerThreadLifecycleObserver, contextDestroyed()) .Times(1); }
void StateManager::runCommand(const std::string &command, const std::string &arguments) { assert(m_initialised); if (command == CMD_LOAD_STATE_CONFIG) { std::string a = arguments; m_state_configs.push_back(a); System::instance()->getFileHandler()->getFilePath(a); readFiles(a); } else if (command == CMD_reload_config_states) { // Destroy current display lists contextDestroyed(true); // We can safely re-read the config files to overwrite existing data // This only breaks if the config file does no specify all fields std::list<std::string>::const_iterator I = m_state_configs.begin(); std::list<std::string>::const_iterator Iend = m_state_configs.end(); while (I != Iend) { std::string args_cpy = *I++; System::instance()->getFileHandler()->getFilePath(args_cpy); readFiles(args_cpy); } contextCreated(); } }
TEST_F(SuspendableObjectTest, MoveToStoppedDocument) { destDocument().shutdown(); EXPECT_CALL(activeDOMObject(), contextDestroyed()); activeDOMObject().didMoveToNewExecutionContext(&destDocument()); }