diff options
author | Eike Rathke <erack@redhat.com> | 2016-04-19 18:26:21 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-04-19 18:31:34 +0200 |
commit | 563638f2e52b8ea6408422de7861ad82594b9842 (patch) | |
tree | 4fe7e96dce9fcdf45edb6770324f047524df2ab0 | |
parent | 5be5f00fe16b0e255b31fbaba5f119773d1cd071 (diff) |
introduce DEBUG_SD_CONFIGURATION_TRACE instead of OSL_DEBUG_LEVEL>=2
... and partly revert the corresponding pieces of
3d2f43438d4fe6947965a98262b0db42c8d5e680 that removed them as unused
code.
Change-Id: Ib5418df6a675004d0822b77ef12a77564d3348c8
6 files changed, 65 insertions, 9 deletions
diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx index 74b2e571450a..9e116b8b046e 100644 --- a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx +++ b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "debugtrace.hxx" #include "ChangeRequestQueueProcessor.hxx" #include "ConfigurationTracer.hxx" @@ -34,7 +35,7 @@ using namespace ::com::sun::star::drawing::framework; namespace { -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE void TraceRequest (const Reference<XConfigurationChangeRequest>& rxRequest) { @@ -80,7 +81,7 @@ void ChangeRequestQueueProcessor::AddRequest ( { ::osl::MutexGuard aGuard (maMutex); -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE if (maQueue.empty()) { SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": Adding requests to empty queue"); @@ -140,7 +141,7 @@ void ChangeRequestQueueProcessor::ProcessOneEvent() // Execute the change request. if (xRequest.is()) { -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE TraceRequest(xRequest); #endif xRequest->execute(mxConfiguration); @@ -153,7 +154,7 @@ void ChangeRequestQueueProcessor::ProcessOneEvent() // its state. if (mpConfigurationUpdater.get() != nullptr) { -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE ConfigurationTracer::TraceConfiguration ( mxConfiguration, "updating to configuration"); #endif diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx index a7a77e83f463..f0ed7671129e 100644 --- a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx @@ -162,6 +162,24 @@ void ConfigurationClassifier::CopyResources ( } } +#if DEBUG_SD_CONFIGURATION_TRACE + +void ConfigurationClassifier::TraceResourceIdVector ( + const sal_Char* pMessage, + const ResourceIdVector& rResources) +{ + + SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": " << pMessage); + ResourceIdVector::const_iterator iResource; + for (iResource=rResources.begin(); iResource!=rResources.end(); ++iResource) + { + OUString sResource (FrameworkHelper::ResourceIdToString(*iResource)); + SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": " << + OUStringToOString(sResource, RTL_TEXTENCODING_UTF8).getStr()); + } +} + +#endif } } // end of namespace sd::framework diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx index a40247d05a89..c26263330413 100644 --- a/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx +++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_CONFIGURATIONCLASSIFIER_HXX #define INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_CONFIGURATIONCLASSIFIER_HXX +#include "debugtrace.hxx" + #include <com/sun/star/drawing/framework/XConfiguration.hpp> #include <vector> @@ -73,6 +75,23 @@ public: */ const ResourceIdVector& GetC2minusC1() const { return maC2minusC1;} +#if DEBUG_SD_CONFIGURATION_TRACE + + /** Return the resources that belong to both the configurations that + where given to the constructor. + @return + A reference to the, possibly empty, list of resources is + returned. This reference remains valid as long as the called + ConfigurationClassifier object stays alive. + */ + const ResourceIdVector& GetC1andC2() const { return maC1andC2;} + + static void TraceResourceIdVector ( + const sal_Char* pMessage, + const ResourceIdVector& rResources); + +#endif + private: css::uno::Reference<css::drawing::framework::XConfiguration> mxConfiguration1; css::uno::Reference<css::drawing::framework::XConfiguration> mxConfiguration2; diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index 11166529e00d..b15ca317b626 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -430,7 +430,7 @@ void SAL_CALL ConfigurationController::restoreConfiguration ( #endif ConfigurationClassifier aClassifier (rxNewConfiguration, xCurrentConfiguration); aClassifier.Partition(); -#if OSL_DEBUG_LEVEL >=2 +#if DEBUG_SD_CONFIGURATION_TRACE aClassifier.TraceResourceIdVector( "requested but not current resources:\n", aClassifier.GetC1minusC2()); aClassifier.TraceResourceIdVector( diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index 386613073a77..4bbeb6d76595 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -141,7 +141,7 @@ void ConfigurationUpdater::UpdateConfiguration() ConfigurationClassifier aClassifier(mxRequestedConfiguration, mxCurrentConfiguration); if (aClassifier.Partition()) { -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationUpdater::UpdateConfiguration("); ConfigurationTracer::TraceConfiguration( mxRequestedConfiguration, "requested configuration"); @@ -174,7 +174,7 @@ void ConfigurationUpdater::UpdateConfiguration() else { SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": nothing to do"); -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE ConfigurationTracer::TraceConfiguration( mxRequestedConfiguration, "requested configuration"); ConfigurationTracer::TraceConfiguration( @@ -236,7 +236,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie { try { -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE rClassifier.TraceResourceIdVector( "requested but not current resources:", rClassifier.GetC1minusC2()); rClassifier.TraceResourceIdVector( @@ -252,7 +252,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie mpResourceManager->DeactivateResources(rClassifier.GetC2minusC1(), mxCurrentConfiguration); mpResourceManager->ActivateResources(rClassifier.GetC1minusC2(), mxCurrentConfiguration); -#if OSL_DEBUG_LEVEL >= 2 +#if DEBUG_SD_CONFIGURATION_TRACE SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::UpdateConfiguration)"); ConfigurationTracer::TraceConfiguration( mxRequestedConfiguration, "requested configuration"); diff --git a/sd/source/ui/framework/configuration/debugtrace.hxx b/sd/source/ui/framework/configuration/debugtrace.hxx new file mode 100644 index 000000000000..b99887051cec --- /dev/null +++ b/sd/source/ui/framework/configuration/debugtrace.hxx @@ -0,0 +1,18 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * 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 INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_DEBUGTRACE_HXX +#define INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_DEBUGTRACE_HXX + +/// Centrally define activation of configuration debug traces. +#define DEBUG_SD_CONFIGURATION_TRACE 0 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |