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

Unified Diff: src/plugin/PluginUtil.cpp

Issue 6032593782833152: Issue 1173 - proposal for entry point (Closed)
Patch Set: base on current tip Created Jan. 29, 2015, 1:29 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginUtil.cpp
diff --git a/src/plugin/PluginUtil.cpp b/src/plugin/PluginUtil.cpp
index fe7acb6b7c81194819966308eab9b1cef9238f4b..3c8bf354745b5530cfae4e1420adc3c627c6d29d 100644
--- a/src/plugin/PluginUtil.cpp
+++ b/src/plugin/PluginUtil.cpp
@@ -1,20 +1,20 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2015 Eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- */
-
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-2015 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "PluginStdAfx.h"
#include <algorithm>
#include <stdexcept>
@@ -45,3 +45,38 @@ std::wstring FileUrl(const std::wstring& path)
std::replace(url.begin(), url.end(), L'\\', L'/');
return L"file:///" + url;
}
+
+bool EntryPoint(const std::function<void()>& functionBody)
+{
+ bool withoutException = true;
+ if (!functionBody)
+ {
+ return withoutException;
+ }
+ try
+ {
+ functionBody();
+ } catch(...)
+ {
+ withoutException = false;
+ }
+ return withoutException;
+}
+
+HRESULT EntryPointWithHResult(const std::function<HRESULT()>& functionBody)
+{
+ HRESULT retValue = S_OK;
+ if (!functionBody)
+ {
+ return retValue;
+ }
+ try
+ {
+ functionBody();
+ } catch(...)
+ {
+ retValue = E_FAIL;
+ }
+ return retValue;
+}
+
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld