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

Delta Between Two Patch Sets: src/plugin/PluginTabBase.cpp

Issue 11427013: Appear fast for IE (Closed)
Left Patch Set: Created Aug. 7, 2013, 5:44 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL);
Felix Dahlke 2013/08/07 09:34:49 Since this is C++, we should use true and false in
33 33
34 CPluginClient* client = CPluginClient::GetInstance(); 34 CPluginClient* client = CPluginClient::GetInstance();
35 if (client->GetIEVersion() < 10) 35 if (client->GetIEVersion() < 10)
36 { 36 {
37 m_isActivated = true; 37 m_isActivated = true;
38 } 38 }
39 39
40 DWORD id; 40 DWORD id;
41 m_hThread = ::CreateThread(NULL, 0, ThreadProc, (LPVOID)this, CREATE_SUSPENDED , &id); 41 m_hThread = ::CreateThread(NULL, 0, ThreadProc, (LPVOID)this, CREATE_SUSPENDED , &id);
42 if (m_hThread) 42 if (m_hThread)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 { 76 {
77 m_isActivated = true; 77 m_isActivated = true;
78 } 78 }
79 79
80 80
81 void CPluginTabBase::OnUpdate() 81 void CPluginTabBase::OnUpdate()
82 { 82 {
83 m_isActivated = true; 83 m_isActivated = true;
84 } 84 }
85 85
86 DWORD WINAPI FilterLoader(void* thisPtrVoid) 86 DWORD WINAPI FilterLoader(void* thisPtrVoid)
Wladimir Palant 2013/08/13 09:41:02 Use LPVOID rather than void* to match ThreadProc s
87 { 87 {
88 CPluginTabBase* thisPtr = (CPluginTabBase*)thisPtrVoid; 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())); 89 thisPtr->m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHid ingSelectors(thisPtr->GetDocumentDomain().GetString()));
90 SetEvent(thisPtr->m_filter->hideFiltersLoadedEvent); 90 SetEvent(thisPtr->m_filter->hideFiltersLoadedEvent);
91 return 0; 91 return 0;
92 } 92 }
93 93
94 void CPluginTabBase::OnNavigate(const CString& url) 94 void CPluginTabBase::OnNavigate(const CString& url)
95 { 95 {
96 SetDocumentUrl(url); 96 SetDocumentUrl(url);
97 97
98 98
99 #ifdef SUPPORT_FRAME_CACHING 99 #ifdef SUPPORT_FRAME_CACHING
100 ClearFrameCache(GetDocumentDomain()); 100 ClearFrameCache(GetDocumentDomain());
101 #endif 101 #endif
102 102
103 std::wstring domainString = GetDocumentDomain(); 103 std::wstring domainString = GetDocumentDomain();
104 ResetEvent(m_filter->hideFiltersLoadedEvent); 104 ResetEvent(m_filter->hideFiltersLoadedEvent);
105 CreateThread(NULL, NULL, &FilterLoader, this, NULL, NULL); 105 CreateThread(NULL, NULL, &FilterLoader, this, NULL, NULL);
Felix Dahlke 2013/08/07 13:23:03 How I see it, this is the relevant change, right?
Oleksandr 2013/08/07 16:07:40 This is not the only relevant change. This is just
106 106
107 #ifdef SUPPORT_DOM_TRAVERSER 107 #ifdef SUPPORT_DOM_TRAVERSER
108 m_traverser->ClearCache(); 108 m_traverser->ClearCache();
109 #endif 109 #endif
110 } 110 }
111 111
112 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) 112 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser)
113 { 113 {
114 #ifdef SUPPORT_DOM_TRAVERSER 114 #ifdef SUPPORT_DOM_TRAVERSER
115 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
359 359
360 // Non-hanging sleep 360 // Non-hanging sleep
361 Sleep(50); 361 Sleep(50);
362 } 362 }
363 363
364 tabLoopIteration++; 364 tabLoopIteration++;
365 } 365 }
366 366
367 return 0; 367 return 0;
368 } 368 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld