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

Delta Between Two Patch Sets: src/plugin/PluginDomTraverserBase.h

Issue 6136782441676800: No issue - clean white spaces in PluginDomTraverserBase.h (Closed)
Left Patch Set: Created Dec. 8, 2014, 10:40 a.m.
Right Patch Set: fix direction and remove one additional case Created Dec. 10, 2014, 3: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
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #ifndef _PLUGIN_DOM_TRAVERSER_BASE_H_ 1 #ifndef _PLUGIN_DOM_TRAVERSER_BASE_H_
2 #define _PLUGIN_DOM_TRAVERSER_BASE_H_ 2 #define _PLUGIN_DOM_TRAVERSER_BASE_H_
3 3
4 4
5 #include "PluginTypedef.h" 5 #include "PluginTypedef.h"
6 #include "PluginTab.h" 6 #include "PluginTab.h"
7 7
8 8
9 class CPluginDomTraverserCacheBase 9 class CPluginDomTraverserCacheBase
10 { 10 {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return CPluginSettings::GetInstance()->IsPluginEnabled(); 109 return CPluginSettings::GetInstance()->IsPluginEnabled();
110 } 110 }
111 111
112 112
113 template <class T> 113 template <class T>
114 void CPluginDomTraverserBase<T>::TraverseDocument(IWebBrowser2* pBrowser, bool i sMainDoc, CString indent) 114 void CPluginDomTraverserBase<T>::TraverseDocument(IWebBrowser2* pBrowser, bool i sMainDoc, CString indent)
115 { 115 {
116 DWORD res = WaitForSingleObject(m_tab->m_filter->hideFiltersLoadedEvent, ENGIN E_STARTUP_TIMEOUT); 116 DWORD res = WaitForSingleObject(m_tab->m_filter->hideFiltersLoadedEvent, ENGIN E_STARTUP_TIMEOUT);
117 if (!IsEnabled()) return; 117 if (!IsEnabled()) return;
118 118
119 VARIANT_BOOL isBusy; 119 VARIANT_BOOL isBusy;
120 if (SUCCEEDED(pBrowser->get_Busy(&isBusy))) 120 if (SUCCEEDED(pBrowser->get_Busy(&isBusy)))
121 { 121 {
122 if (isBusy) 122 if (isBusy)
123 { 123 {
124 return; 124 return;
125 } 125 }
126 } 126 }
127 127
128 // Get document 128 // Get document
129 CComPtr<IDispatch> pDocDispatch; 129 CComPtr<IDispatch> pDocDispatch;
(...skipping 22 matching lines...) Expand all
152 pBodyEl = pBody; 152 pBodyEl = pBody;
153 } 153 }
154 else 154 else
155 { 155 {
156 CComPtr<IHTMLElementCollection> pBodyCollection; 156 CComPtr<IHTMLElementCollection> pBodyCollection;
157 if (FAILED(pDoc->getElementsByTagName(L"body", &pBodyCollection)) || !pBodyC ollection) 157 if (FAILED(pDoc->getElementsByTagName(L"body", &pBodyCollection)) || !pBodyC ollection)
158 { 158 {
159 return; 159 return;
160 } 160 }
161 161
162 CComVariant vIndex(0); 162 CComVariant vIndex(0);
163 CComPtr<IDispatch> pBodyDispatch; 163 CComPtr<IDispatch> pBodyDispatch;
164 if (FAILED(pBodyCollection->item(vIndex, vIndex, &pBodyDispatch)) || !pBodyD ispatch) 164 if (FAILED(pBodyCollection->item(vIndex, vIndex, &pBodyDispatch)) || !pBodyD ispatch)
165 { 165 {
166 return; 166 return;
167 } 167 }
168 168
169 if (FAILED(pBodyDispatch->QueryInterface(IID_IHTMLElement, (LPVOID*)&pBodyEl )) || !pBodyEl) 169 if (FAILED(pBodyDispatch->QueryInterface(IID_IHTMLElement, (LPVOID*)&pBodyEl )) || !pBodyEl)
170 { 170 {
171 return; 171 return;
172 } 172 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 CPluginClient::UnescapeUrl(src); 282 CPluginClient::UnescapeUrl(src);
283 283
284 // Check if Iframe should be traversed 284 // Check if Iframe should be traversed
285 if (OnIFrame(pFrameEl, src, indent)) 285 if (OnIFrame(pFrameEl, src, indent))
286 { 286 {
287 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 287 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
288 if (pFrameBrowser) 288 if (pFrameBrowser)
289 { 289 {
290 TraverseDocument(pFrameBrowser, false, indent); 290 TraverseDocument(pFrameBrowser, false, indent);
291 } 291 }
292 }» 292 }
293 } 293 }
294 } 294 }
295 } 295 }
296 } 296 }
297 } 297 }
298 } 298 }
299 299
300 300
301 template <class T> 301 template <class T>
302 void CPluginDomTraverserBase<T>::TraverseChild(IHTMLElement* pEl, IWebBrowser2* pBrowser, CString& indent, bool isCached) 302 void CPluginDomTraverserBase<T>::TraverseChild(IHTMLElement* pEl, IWebBrowser2* pBrowser, CString& indent, bool isCached)
303 { 303 {
304 int cacheIndex = -1; 304 int cacheIndex = -1;
305 long cacheAllElementsCount = -1; 305 long cacheAllElementsCount = -1;
306 306
307 m_criticalSection.Lock(); 307 m_criticalSection.Lock();
308 { 308 {
309 CComVariant vCacheIndex; 309 CComVariant vCacheIndex;
310 if (isCached && SUCCEEDED(pEl->getAttribute(L"abp", 0, &vCacheIndex)) && vCa cheIndex.vt == VT_I4) 310 if (isCached && SUCCEEDED(pEl->getAttribute(L"abp", 0, &vCacheIndex)) && vCa cheIndex.vt == VT_I4)
311 { 311 {
312 cacheIndex = vCacheIndex.intVal; 312 cacheIndex = vCacheIndex.intVal;
313 313
314 cacheAllElementsCount = m_cacheElements[cacheIndex].m_elements; 314 cacheAllElementsCount = m_cacheElements[cacheIndex].m_elements;
315 } 315 }
316 else 316 else
317 { 317 {
318 isCached = false; 318 isCached = false;
319 319
320 cacheIndex = m_cacheIndexLast++; 320 cacheIndex = m_cacheIndexLast++;
321 321
322 // Resize cache??? 322 // Resize cache???
323 if (cacheIndex >= m_cacheElementsMax) 323 if (cacheIndex >= m_cacheElementsMax)
324 { 324 {
325 T* oldCacheElements = m_cacheElements; 325 T* oldCacheElements = m_cacheElements;
326 326
327 m_cacheElements = new T[2*m_cacheElementsMax]; 327 m_cacheElements = new T[2*m_cacheElementsMax];
328 328
329 memcpy(m_cacheElements, oldCacheElements, m_cacheElementsMax*sizeof(T)); 329 memcpy(m_cacheElements, oldCacheElements, m_cacheElementsMax*sizeof(T));
330 330
331 m_cacheElementsMax *= 2; 331 m_cacheElementsMax *= 2;
332 332
333 delete [] oldCacheElements; 333 delete [] oldCacheElements;
334 } 334 }
335 335
336 m_cacheElements[cacheIndex].Init(); 336 m_cacheElements[cacheIndex].Init();
337 337
338 vCacheIndex.vt = VT_I4; 338 vCacheIndex.vt = VT_I4;
339 vCacheIndex.intVal = cacheIndex; 339 vCacheIndex.intVal = cacheIndex;
340 340
341 pEl->setAttribute(L"abp", vCacheIndex); 341 pEl->setAttribute(L"abp", vCacheIndex);
342 } 342 }
343 } 343 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 { 448 {
449 m_cacheIndexLast = 0; 449 m_cacheIndexLast = 0;
450 m_cacheDocumentHasFrames.clear(); 450 m_cacheDocumentHasFrames.clear();
451 m_cacheDocumentHasIframes.clear(); 451 m_cacheDocumentHasIframes.clear();
452 } 452 }
453 m_criticalSection.Unlock(); 453 m_criticalSection.Unlock();
454 } 454 }
455 455
456 456
457 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ 457 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld