Bug 1368418 part 1 - Remove nsISemanticUnitScanner. r=emk
authorXidorn Quan <me@upsuper.org>
Mon, 29 May 2017 16:05:29 +1000
changeset 409291 c14a7823ce37ca55fc78e0d7e970e8ee764fcd80
parent 409290 0ca74eae6bebe1ddbc4f807e7b20d026a4c40779
child 409292 bb587e11b75f879010b092987aa2de2b8ccfcbcb
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1368418
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1368418 part 1 - Remove nsISemanticUnitScanner. r=emk Code search indicates that this is not used internally, and the only addon uses this is Breadcrumbs, which hasn't been updated since 2009, thus it is already not compatible with current Firefox. MozReview-Commit-ID: 1lUs7ceaaE1
browser/installer/package-manifest.in
intl/build/nsI18nModule.cpp
intl/lwbrk/moz.build
intl/lwbrk/nsISemanticUnitScanner.idl
intl/lwbrk/nsSemanticUnitScanner.cpp
intl/lwbrk/nsSemanticUnitScanner.h
mobile/android/installer/package-manifest.in
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -254,17 +254,16 @@
 @RESPATH@/browser/components/jsinspector.xpt
 @RESPATH@/components/layout_base.xpt
 #ifdef NS_PRINTING
 @RESPATH@/components/layout_printing.xpt
 #endif
 @RESPATH@/components/layout_xul_tree.xpt
 @RESPATH@/components/layout_xul.xpt
 @RESPATH@/components/locale.xpt
-@RESPATH@/components/lwbrk.xpt
 #ifdef MOZ_GECKO_PROFILER
 @RESPATH@/components/memory_profiler.xpt
 #endif
 @RESPATH@/browser/components/migration.xpt
 @RESPATH@/components/mimetype.xpt
 @RESPATH@/components/mozfind.xpt
 #ifdef ENABLE_INTL_API
 @RESPATH@/components/mozintl.xpt
--- a/intl/build/nsI18nModule.cpp
+++ b/intl/build/nsI18nModule.cpp
@@ -5,18 +5,16 @@
 
 #include "mozilla/ModuleUtils.h"
 
 // lwbrk
 #include "nsLWBrkCIID.h"
 #include "nsJISx4051LineBreaker.h"
 #include "nsSampleWordBreaker.h"
 
-#include "nsSemanticUnitScanner.h"
-
 // unicharutil
 #include "nsCategoryImp.h"
 #include "nsUnicharUtilCIID.h"
 #include "nsCaseConversionImp2.h"
 #include "nsEntityConverter.h"
 #include "nsSaveAsCharset.h"
 #include "nsUnicodeNormalizer.h"
 
@@ -27,33 +25,30 @@
 // locale
 #include "nsLocaleConstructors.h"
 
 // uconv
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsJISx4051LineBreaker)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleWordBreaker)
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSemanticUnitScanner)
-
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleTextOverride, Init)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCaseConversionImp2)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsCategoryImp,
                                          nsCategoryImp::GetInstance)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsEntityConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSaveAsCharset)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeNormalizer)
 
 NS_DEFINE_NAMED_CID(MOZ_LOCALESERVICE_CID);
 NS_DEFINE_NAMED_CID(MOZ_OSPREFERENCES_CID);
 NS_DEFINE_NAMED_CID(NS_LBRK_CID);
 NS_DEFINE_NAMED_CID(NS_WBRK_CID);
-NS_DEFINE_NAMED_CID(NS_SEMANTICUNITSCANNER_CID);
 NS_DEFINE_NAMED_CID(NS_UNICHARUTIL_CID);
 NS_DEFINE_NAMED_CID(NS_UNICHARCATEGORY_CID);
 NS_DEFINE_NAMED_CID(NS_ENTITYCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_SAVEASCHARSET_CID);
 NS_DEFINE_NAMED_CID(NS_UNICODE_NORMALIZER_CID);
 NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID);
 NS_DEFINE_NAMED_CID(NS_LOCALESERVICE_CID);
@@ -62,17 +57,16 @@ NS_DEFINE_NAMED_CID(NS_SCRIPTABLEDATEFOR
 NS_DEFINE_NAMED_CID(NS_PLATFORMCHARSET_CID);
 NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
 
 static const mozilla::Module::CIDEntry kIntlCIDs[] = {
     { &kMOZ_LOCALESERVICE_CID, false, nullptr, mozilla::intl::LocaleServiceConstructor },
     { &kMOZ_OSPREFERENCES_CID, false, nullptr, mozilla::intl::OSPreferencesConstructor },
     { &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor },
     { &kNS_WBRK_CID, false, nullptr, nsSampleWordBreakerConstructor },
-    { &kNS_SEMANTICUNITSCANNER_CID, false, nullptr, nsSemanticUnitScannerConstructor },
     { &kNS_UNICHARUTIL_CID, false, nullptr, nsCaseConversionImp2Constructor },
     { &kNS_UNICHARCATEGORY_CID, false, nullptr, nsCategoryImpConstructor },
     { &kNS_ENTITYCONVERTER_CID, false, nullptr, nsEntityConverterConstructor },
     { &kNS_SAVEASCHARSET_CID, false, nullptr, nsSaveAsCharsetConstructor },
     { &kNS_UNICODE_NORMALIZER_CID, false, nullptr, nsUnicodeNormalizerConstructor },
     { &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor },
     { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor },
     { &kNS_LOCALESERVICE_CID, false, nullptr, CreateLocaleService },
@@ -83,17 +77,16 @@ static const mozilla::Module::CIDEntry k
     { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
     { MOZ_LOCALESERVICE_CONTRACTID, &kMOZ_LOCALESERVICE_CID },
     { MOZ_OSPREFERENCES_CONTRACTID, &kMOZ_OSPREFERENCES_CID },
     { NS_LBRK_CONTRACTID, &kNS_LBRK_CID },
     { NS_WBRK_CONTRACTID, &kNS_WBRK_CID },
-    { NS_SEMANTICUNITSCANNER_CONTRACTID, &kNS_SEMANTICUNITSCANNER_CID },
     { NS_UNICHARUTIL_CONTRACTID, &kNS_UNICHARUTIL_CID },
     { NS_UNICHARCATEGORY_CONTRACTID, &kNS_UNICHARCATEGORY_CID },
     { NS_ENTITYCONVERTER_CONTRACTID, &kNS_ENTITYCONVERTER_CID },
     { NS_SAVEASCHARSET_CONTRACTID, &kNS_SAVEASCHARSET_CID },
     { NS_UNICODE_NORMALIZER_CONTRACTID, &kNS_UNICODE_NORMALIZER_CID },
     { NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID },
     { NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID },
     { NS_LOCALESERVICE_CONTRACTID, &kNS_LOCALESERVICE_CID },
--- a/intl/lwbrk/moz.build
+++ b/intl/lwbrk/moz.build
@@ -1,32 +1,25 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_DIRS += ['gtest']
 
-XPIDL_SOURCES += [
-    'nsISemanticUnitScanner.idl',
-]
-
-XPIDL_MODULE = 'lwbrk'
-
 EXPORTS += [
     'nsILineBreaker.h',
     'nsIWordBreaker.h',
     'nsLWBrkCIID.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsJISx4051LineBreaker.cpp',
     'nsSampleWordBreaker.cpp',
-    'nsSemanticUnitScanner.cpp',
 ]
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
     SOURCES += [
         'nsPangoBreaker.cpp',
     ]
     CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
deleted file mode 100644
--- a/intl/lwbrk/nsISemanticUnitScanner.idl
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-%{C++
-// {ADF42751-1CEF-4ad2-AA8E-BCB849D8D31F}
-#define NS_SEMANTICUNITSCANNER_CID { 0xadf42751, 0x1cef, 0x4ad2, { 0xaa, 0x8e, 0xbc, 0xb8, 0x49, 0xd8, 0xd3, 0x1f}}
-#define NS_SEMANTICUNITSCANNER_CONTRACTID "@mozilla.org/intl/semanticunitscanner;1"
-%}
-
-/**
- * Provides a language independent way to break UNICODE
- * text into meaningful semantic units (e.g. words).
- */
-[scriptable, uuid(9f620be4-e535-11d6-b254-00039310a47a)]
-interface nsISemanticUnitScanner : nsISupports {
-    /**
-     * start()
-     *
-     * Starts up the semantic unit scanner with an optional
-     * character set, which acts as a hint to optimize the heuristics
-     * used to determine the language(s) of the processed text.
-     *
-     * @param characterSet the character set the text was originally
-     *                     encoded in (can be NULL)
-     */
-    void start(in string characterSet);
-
-    /**
-     * next()
-     * Get the begin / end offset of the next unit in the current text
-     *
-     * @param text the text to be scanned
-     * @param length the number of characters in the text to be processed
-     * @param pos the current position
-     * @param isLastBuffer, the buffer is the last one
-     * @param begin the begin offset of the next unit 
-     * @param begin the end offset of the next unit 
-     * @return has more unit in the current text
-     */
-    boolean next(in wstring text, in long length, in long pos, 
-              in boolean isLastBuffer,
-              out long begin, out long end );
-
-};
deleted file mode 100644
--- a/intl/lwbrk/nsSemanticUnitScanner.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsSemanticUnitScanner.h"
-
-NS_IMPL_ISUPPORTS_INHERITED(nsSemanticUnitScanner, nsSampleWordBreaker, nsISemanticUnitScanner)
-
-nsSemanticUnitScanner::nsSemanticUnitScanner() : nsSampleWordBreaker()
-{
-  /* member initializers and constructor code */
-}
-
-nsSemanticUnitScanner::~nsSemanticUnitScanner()
-{
-  /* destructor code */
-}
-
-
-NS_IMETHODIMP nsSemanticUnitScanner::Start(const char *characterSet)
-{
-    // do nothing for now.
-    return NS_OK;
-}
-
-NS_IMETHODIMP nsSemanticUnitScanner::Next(const char16_t *text, int32_t length, int32_t pos, bool isLastBuffer, int32_t *begin, int32_t *end, bool *_retval)
-{
-    // xxx need to bullet proff and check input pointer 
-    //  make sure begin, end and _retval is not nullptr here
-
-    // if we reach the end, just return
-    if (pos >= length) {
-       *begin = pos;
-       *end = pos;
-       *_retval = false;
-       return NS_OK;
-    }
-
-    uint8_t char_class = nsSampleWordBreaker::GetClass(text[pos]);
-
-    // if we are in chinese mode, return one han letter at a time
-    // we should not do this if we are in Japanese or Korean mode
-    if (kWbClassHanLetter == char_class) {
-       *begin = pos;
-       *end = pos+1;
-       *_retval = true;
-       return NS_OK;
-    }
-
-    int32_t next;
-    // find the next "word"
-    next = NextWord(text, (uint32_t) length, (uint32_t) pos);
-
-    // if we don't have enough text to make decision, return 
-    if (next == NS_WORDBREAKER_NEED_MORE_TEXT) {
-       *begin = pos;
-       *end = isLastBuffer ? length : pos;
-       *_retval = isLastBuffer;
-       return NS_OK;
-    } 
-    
-    // if what we got is space or punct, look at the next break
-    if ((char_class == kWbClassSpace) || (char_class == kWbClassPunct)) {
-        // if the next "word" is not letters, 
-        // call itself recursively with the new pos
-        return Next(text, length, next, isLastBuffer, begin, end, _retval);
-    }
-
-    // for the rest, return 
-    *begin = pos;
-    *end = next;
-    *_retval = true;
-    return NS_OK;
-}
-
deleted file mode 100644
--- a/intl/lwbrk/nsSemanticUnitScanner.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsSemanticUnitScanner_h__
-#define nsSemanticUnitScanner_h__
-
-#include "nsSampleWordBreaker.h"
-#include "nsISemanticUnitScanner.h"
-
-
-class nsSemanticUnitScanner : public nsISemanticUnitScanner
-                            , public nsSampleWordBreaker
-{
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSISEMANTICUNITSCANNER
-
-  nsSemanticUnitScanner();
-
-private:
-  virtual ~nsSemanticUnitScanner();
-  /* additional members */
-};
-
-#endif
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -168,17 +168,16 @@
 @BINPATH@/components/jsinspector.xpt
 @BINPATH@/components/layout_base.xpt
 #ifdef NS_PRINTING
 @BINPATH@/components/layout_printing.xpt
 #endif
 @BINPATH@/components/layout_xul_tree.xpt
 @BINPATH@/components/layout_xul.xpt
 @BINPATH@/components/locale.xpt
-@BINPATH@/components/lwbrk.xpt
 #ifdef MOZ_GECKO_PROFILER
 @BINPATH@/components/memory_profiler.xpt
 #endif
 @BINPATH@/components/mimetype.xpt
 @BINPATH@/components/mozfind.xpt
 #ifdef ENABLE_INTL_API
 @BINPATH@/components/mozintl.xpt
 #endif