Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginTabBase.cpp

Issue 11427013: Appear fast for IE (Closed)
Patch Set: Comments addressed Created Aug. 7, 2013, 4:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClient.h" 3 #include "PluginClient.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #ifdef SUPPORT_CONFIG 5 #ifdef SUPPORT_CONFIG
6 #include "PluginConfig.h" 6 #include "PluginConfig.h"
7 #endif 7 #endif
8 #include "PluginTab.h" 8 #include "PluginTab.h"
9 #include "PluginDomTraverser.h" 9 #include "PluginDomTraverser.h"
10 #include "PluginClass.h" 10 #include "PluginClass.h"
(...skipping 11 matching lines...) Expand all
22 int CPluginTabBase::s_whitelistVersion = 0; 22 int CPluginTabBase::s_whitelistVersion = 0;
23 #endif 23 #endif
24 #ifdef SUPPORT_CONFIG 24 #ifdef SUPPORT_CONFIG
25 int CPluginTabBase::s_configVersion = 0; 25 int CPluginTabBase::s_configVersion = 0;
26 #endif 26 #endif
27 27
28 28
29 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false) 29 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false)
30 { 30 {
31 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); 31 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter());
32 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL);
32 33
33 CPluginClient* client = CPluginClient::GetInstance(); 34 CPluginClient* client = CPluginClient::GetInstance();
34 if (client->GetIEVersion() < 10) 35 if (client->GetIEVersion() < 10)
35 { 36 {
36 m_isActivated = true; 37 m_isActivated = true;
37 } 38 }
38 39
39 DWORD id; 40 DWORD id;
40 m_hThread = ::CreateThread(NULL, 0, ThreadProc, (LPVOID)this, CREATE_SUSPENDED , &id); 41 m_hThread = ::CreateThread(NULL, 0, ThreadProc, (LPVOID)this, CREATE_SUSPENDED , &id);
41 if (m_hThread) 42 if (m_hThread)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 { 76 {
76 m_isActivated = true; 77 m_isActivated = true;
77 } 78 }
78 79
79 80
80 void CPluginTabBase::OnUpdate() 81 void CPluginTabBase::OnUpdate()
81 { 82 {
82 m_isActivated = true; 83 m_isActivated = true;
83 } 84 }
84 85
86 DWORD WINAPI FilterLoader(void* thisPtrVoid)
Wladimir Palant 2013/08/13 09:41:02 Use LPVOID rather than void* to match ThreadProc s
87 {
88 CPluginTabBase* thisPtr = (CPluginTabBase*)thisPtrVoid;
Wladimir Palant 2013/08/13 09:41:02 Given that there really is no "this" pointer here
89 thisPtr->m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHid ingSelectors(thisPtr->GetDocumentDomain().GetString()));
90 SetEvent(thisPtr->m_filter->hideFiltersLoadedEvent);
91 return 0;
92 }
85 93
86 void CPluginTabBase::OnNavigate(const CString& url) 94 void CPluginTabBase::OnNavigate(const CString& url)
87 { 95 {
88 SetDocumentUrl(url); 96 SetDocumentUrl(url);
89 97
90 98
91 #ifdef SUPPORT_FRAME_CACHING 99 #ifdef SUPPORT_FRAME_CACHING
92 ClearFrameCache(GetDocumentDomain()); 100 ClearFrameCache(GetDocumentDomain());
93 #endif 101 #endif
94 102
95 std::wstring domainString = GetDocumentDomain(); 103 std::wstring domainString = GetDocumentDomain();
96 m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHidingSelect ors(domainString)); 104 ResetEvent(m_filter->hideFiltersLoadedEvent);
105 CreateThread(NULL, NULL, &FilterLoader, this, NULL, NULL);
97 106
98 #ifdef SUPPORT_DOM_TRAVERSER 107 #ifdef SUPPORT_DOM_TRAVERSER
99 m_traverser->ClearCache(); 108 m_traverser->ClearCache();
100 #endif 109 #endif
101 } 110 }
102 111
103 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) 112 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser)
104 { 113 {
105 #ifdef SUPPORT_DOM_TRAVERSER 114 #ifdef SUPPORT_DOM_TRAVERSER
106 if (!CPluginClient::GetInstance()->IsWhitelistedUrl(std::wstring(GetDocumentUr l()))) 115 if (!CPluginClient::GetInstance()->IsWhitelistedUrl(std::wstring(GetDocumentUr l())))
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 359
351 // Non-hanging sleep 360 // Non-hanging sleep
352 Sleep(50); 361 Sleep(50);
353 } 362 }
354 363
355 tabLoopIteration++; 364 tabLoopIteration++;
356 } 365 }
357 366
358 return 0; 367 return 0;
359 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld