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

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

Issue 10825021: Move settings page into the application directory (Closed)
Patch Set: Created June 3, 2013, 11:40 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/plugin/PluginClass.cpp » ('j') | src/plugin/PluginUtil.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginSettings.h" 3 #include "PluginSettings.h"
4 #include "PluginSystem.h" 4 #include "PluginSystem.h"
5 #include "PluginFilter.h" 5 #include "PluginFilter.h"
6 #include "PluginClientFactory.h" 6 #include "PluginClientFactory.h"
7 #include "PluginDictionary.h" 7 #include "PluginDictionary.h"
8 #include "PluginHttpRequest.h" 8 #include "PluginHttpRequest.h"
9 #include "PluginMutex.h" 9 #include "PluginMutex.h"
10 #include "PluginClass.h" 10 #include "PluginClass.h"
(...skipping 26 matching lines...) Expand all
37 37
38 CloseHandle(processInformation.hProcess); 38 CloseHandle(processInformation.hProcess);
39 CloseHandle(processInformation.hThread); 39 CloseHandle(processInformation.hThread);
40 } 40 }
41 41
42 std::auto_ptr<Communication::Pipe> OpenAdblockPlusEnginePipe() 42 std::auto_ptr<Communication::Pipe> OpenAdblockPlusEnginePipe()
43 { 43 {
44 std::auto_ptr<Communication::Pipe> result; 44 std::auto_ptr<Communication::Pipe> result;
45 try 45 try
46 { 46 {
47 try 47 result.reset(new Communication::Pipe(Communication::pipeName,
48 Communication::Pipe::MODE_CONNECT));
49 }
50 catch (Communication::PipeConnectionError e)
51 {
52 SpawnAdblockPlusEngine();
53
54 int timeout = 10000;
55 const int step = 10;
56 while (!result.get())
48 { 57 {
49 result.reset(new Communication::Pipe(Communication::pipeName, 58 try
50 Communication::Pipe::MODE_CONNECT));
51 }
52 catch (Communication::PipeConnectionError e)
53 {
54 SpawnAdblockPlusEngine();
55
56 int timeout = 10000;
57 const int step = 10;
58 while (!result.get())
59 { 59 {
60 try 60 result.reset(new Communication::Pipe(Communication::pipeName,
61 { 61 Communication::Pipe::MODE_CONNECT));
62 result.reset(new Communication::Pipe(Communication::pipeName, 62 }
63 Communication::Pipe::MODE_CONNECT)); 63 catch (Communication::PipeConnectionError e)
64 } 64 {
65 catch (Communication::PipeConnectionError e) 65 Sleep(step);
66 { 66 timeout -= step;
67 Sleep(step); 67 if (timeout <= 0)
68 timeout -= step; 68 throw std::runtime_error("Unable to open Adblock Plus Engine pipe");
69 if (timeout <= 0)
70 throw std::runtime_error("Unable to open Adblock Plus Engine pipe" );
71 }
72 } 69 }
73 } 70 }
74 } 71 }
75 catch(std::exception e)
76 {
77 DEBUG_GENERAL(e.what());
Wladimir Palant 2013/06/03 11:43:31 I had to remove the try..catch block here - if the
78 }
79 return result; 72 return result;
80 } 73 }
81 74
82 std::vector<std::string> ReadStrings(Communication::InputBuffer& message) 75 std::vector<std::string> ReadStrings(Communication::InputBuffer& message)
83 { 76 {
84 int32_t count; 77 int32_t count;
85 message >> count; 78 message >> count;
86 79
87 std::vector<std::string> result; 80 std::vector<std::string> result;
88 for (int32_t i = 0; i < count; i++) 81 for (int32_t i = 0; i < count; i++)
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 try 362 try
370 { 363 {
371 CallAdblockPlusEngineProcedure(request); 364 CallAdblockPlusEngineProcedure(request);
372 } 365 }
373 catch (const std::exception& e) 366 catch (const std::exception& e)
374 { 367 {
375 DEBUG_GENERAL(e.what()); 368 DEBUG_GENERAL(e.what());
376 } 369 }
377 } 370 }
378 371
OLDNEW
« no previous file with comments | « no previous file | src/plugin/PluginClass.cpp » ('j') | src/plugin/PluginUtil.h » ('J')

Powered by Google App Engine
This is Rietveld