Bug 1267526 part.0 IMMHandler and TSFTextStore should use LazyLogModule instead of PR_NewLogModule for consistency with related logs in dom/events r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 11 May 2016 18:01:34 +0900
changeset 366164 1fb42ec6f691760d3f8b04dbb3f8f64716d9855e
parent 366163 4c31267f1548a995a402f09ad2bfa041706881c4
child 366165 5d3ee4657a96694d0c3675418655a2fc0bf8ae1f
push id17910
push usermasayuki@d-toybox.com
push dateThu, 12 May 2016 03:08:45 +0000
reviewersm_kato
bugs1267526
milestone49.0a1
Bug 1267526 part.0 IMMHandler and TSFTextStore should use LazyLogModule instead of PR_NewLogModule for consistency with related logs in dom/events r?m_kato MozReview-Commit-ID: IDmV291bKsz
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -163,17 +163,17 @@ public:
   virtual ~GetReconvertStringLog() {}
 };
 
 namespace mozilla {
 namespace widget {
 
 static IMMHandler* gIMMHandler = nullptr;
 
-PRLogModuleInfo* gIMMLog = nullptr;
+LazyLogModule gIMMLog("nsIMM32HandlerWidgets");
 
 /******************************************************************************
  * IMEContext
  ******************************************************************************/
 
 IMEContext::IMEContext(HWND aWnd)
   : mWnd(aWnd)
   , mIMC(::ImmGetContext(aWnd))
@@ -233,19 +233,16 @@ IMMHandler::EnsureHandlerInstance()
     gIMMHandler = new IMMHandler();
   }
 }
 
 // static
 void
 IMMHandler::Initialize()
 {
-  if (!gIMMLog) {
-    gIMMLog = PR_NewLogModule("nsIMM32HandlerWidgets");
-  }
   if (!sWM_MSIME_MOUSE) {
     sWM_MSIME_MOUSE = ::RegisterWindowMessage(RWM_MOUSE);
   }
   sAssumeVerticalWritingModeNotSupported =
     Preferences::GetBool(
       "intl.imm.vertical_writing.always_assume_not_supported", false);
   InitKeyboardLayout(nullptr, ::GetKeyboardLayout(0));
 }
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -41,17 +41,17 @@ static const char* kPrefNameForceEnableT
  * after that, start with:
  *   "TSF: 0x%p   TSFFoo::Bar("
  * In an internal method, start with following text:
  *   "TSF: 0x%p   TSFFoo::Bar("
  * When a static method is called, start with following text:
  *   "TSF: TSFFoo::Bar("
  */
 
-PRLogModuleInfo* sTextStoreLog = nullptr;
+LazyLogModule sTextStoreLog("nsTextStoreWidgets");
 
 static const char*
 GetBoolName(bool aBool)
 {
   return aBool ? "true" : "false";
 }
 
 static void
@@ -5368,20 +5368,16 @@ TSFTextStore::MarkContextAsEmpty(ITfCont
           "to mark empty context 0x%p...", aContext));
   comp->SetValue(sClientId, &variant_int4_value1);
 }
 
 // static
 void
 TSFTextStore::Initialize()
 {
-  if (!sTextStoreLog) {
-    sTextStoreLog = PR_NewLogModule("nsTextStoreWidgets");
-  }
-
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
     ("TSF: TSFTextStore::Initialize() is called..."));
 
   if (sThreadMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
       ("TSF:   TSFTextStore::Initialize() FAILED due to already initialized"));
     return;
   }