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

Unified Diff: compiled/FilterNotifier.h

Issue 29398669: Issue 5063 - [emscripten] Make FilterNotifier calls more efficient (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Rebased and made the code deal with 64-bit properties Created April 7, 2017, 7:16 a.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 | « no previous file | compiled/FilterNotifier.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/FilterNotifier.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/compiled/FilterNotifier.h
@@ -0,0 +1,68 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-2017 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/>.
+ */
+
+#pragma once
+
+#include <cstdio>
+
+#include "String.h"
+
+namespace FilterNotifier
+{
+ enum class Topic
+ {
+ NONE,
+ FILTER_DISABLED,
+ FILTER_HITCOUNT,
+ FILTER_LASTHIT,
+ SUBSCRIPTION_TITLE,
+ SUBSCRIPTION_DISABLED,
+ SUBSCRIPTION_FIXEDTITLE,
+ SUBSCRIPTION_HOMEPAGE,
+ SUBSCRIPTION_LASTCHECK,
+ SUBSCRIPTION_LASTDOWNLOAD,
+ SUBSCRIPTION_DOWNLOADSTATUS,
+ SUBSCRIPTION_ERRORS,
+ };
+
+ inline void GenerateCustomBindings()
+ {
+ printf("var FilterNotifier = require('filterNotifier').FilterNotifier;\n");
+ printf("var notifierTopics = new Map([\n");
+ printf(" [%i, 'filter.disabled'],\n", Topic::FILTER_DISABLED);
+ printf(" [%i, 'filter.hitCount'],\n", Topic::FILTER_HITCOUNT);
+ printf(" [%i, 'filter.lastHit'],\n", Topic::FILTER_LASTHIT);
+ printf(" [%i, 'subscription.title'],\n", Topic::SUBSCRIPTION_TITLE);
+ printf(" [%i, 'subscription.disabled'],\n", Topic::SUBSCRIPTION_DISABLED);
+ printf(" [%i, 'subscription.fixedTitle'],\n", Topic::SUBSCRIPTION_FIXEDTITLE);
+ printf(" [%i, 'subscription.homepage'],\n", Topic::SUBSCRIPTION_HOMEPAGE);
+ printf(" [%i, 'subscription.lastCheck'],\n", Topic::SUBSCRIPTION_LASTCHECK);
+ printf(" [%i, 'subscription.lastDownload'],\n", Topic::SUBSCRIPTION_LASTDOWNLOAD);
+ printf(" [%i, 'subscription.downloadStatus'],\n", Topic::SUBSCRIPTION_DOWNLOADSTATUS);
+ printf(" [%i, 'subscription.errors'],\n", Topic::SUBSCRIPTION_ERRORS);
+ printf("]);");
+ }
+
+ void PropertyChange(Topic topic, void* object, bool newValue, bool oldValue);
+ void PropertyChange(Topic topic, void* object, int newValue, int oldValue);
+ void PropertyChange(Topic topic, void* object, unsigned int newValue,
+ unsigned int oldValue);
+ void PropertyChange(Topic topic, void* object, uint64_t newValue,
+ uint64_t oldValue);
+ void PropertyChange(Topic topic, void* object, const String& newValue,
+ const String& oldValue);
+}
« no previous file with comments | « no previous file | compiled/FilterNotifier.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld