--------------------- PatchSet 6121 Date: 2007/11/13 17:40:34 Author: chtsanti Branch: async-calls Tag: (none) Log: - Removing the AsyncCallBase::theObject, it is not used in AsyncCallBase and replacing this method with jobCall::job method. - Renaming some methods and variables names in AsyncCall.h/.cc code to conform with squid3 coding rules: *MemFunT::Object to *MemFunT::object AsyncCallBase::debugSection to AsyncCallBase::theDebugSection AsyncCallBase::debugLevel to AsyncCallBase::theDebugLevel also change some parameter and local variable names Members: src/AsyncCall.cc:1.3.22.2->1.3.22.3 src/AsyncCall.h:1.3.22.2->1.3.22.3 Index: squid3/src/AsyncCall.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AsyncCall.cc,v retrieving revision 1.3.22.2 retrieving revision 1.3.22.3 diff -u -r1.3.22.2 -r1.3.22.3 --- squid3/src/AsyncCall.cc 6 Nov 2007 18:37:01 -0000 1.3.22.2 +++ squid3/src/AsyncCall.cc 13 Nov 2007 17:40:34 -0000 1.3.22.3 @@ -30,37 +30,37 @@ bool JobCall::fire() { - AsyncJob *job = theObject(); + AsyncJob *theJob = job(); - if(!cbdataReferenceValid(job->toCbdata())) + if(!cbdataReferenceValid(theJob->toCbdata())) return false; - if (!job->callStart(theName)) { - debugs(debugSection, debugLevel, HERE << "job call "<< theName <<" NOT fire " << this); + if (!theJob->callStart(theName)) { + debugs(theDebugSection, theDebugLevel, HERE << "job call "<< theName <<" NOT fire " << this); return false; } - debugs(debugSection, debugLevel, HERE << "job call " << theName << " fire " << this); + debugs(theDebugSection, theDebugLevel, HERE << "job call " << theName << " fire " << this); callJob(); - debugs(debugSection, debugLevel, HERE << theName << " fired"); + debugs(theDebugSection, theDebugLevel, HERE << theName << " fired"); return true; } void JobCall::handleException(const TextException &e) { - debugs(debugSection, debugLevel, HERE << "job call exception"); - AsyncJob *job = theObject(); - job->callException(e); + debugs(theDebugSection, theDebugLevel, HERE << "job call exception"); + AsyncJob *theJob = job(); + theJob->callException(e); } void JobCall::end() { - debugs(debugSection, debugLevel, HERE << "job call end"); + debugs(theDebugSection, theDebugLevel, HERE << "job call end"); - AsyncJob *job = theObject(); - if(!cbdataReferenceValid(job->toCbdata())) + AsyncJob *theJob = job(); + if(!cbdataReferenceValid(theJob->toCbdata())) return; - job->callEnd(); + theJob->callEnd(); } Index: squid3/src/AsyncCall.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AsyncCall.h,v retrieving revision 1.3.22.2 retrieving revision 1.3.22.3 diff -u -r1.3.22.2 -r1.3.22.3 --- squid3/src/AsyncCall.h 6 Nov 2007 18:37:01 -0000 1.3.22.2 +++ squid3/src/AsyncCall.h 13 Nov 2007 17:40:34 -0000 1.3.22.3 @@ -1,6 +1,6 @@ /* - * $Id: AsyncCall.h,v 1.3.22.2 2007/11/06 18:37:01 chtsanti Exp $ + * $Id: AsyncCall.h,v 1.3.22.3 2007/11/13 17:40:34 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -112,7 +112,7 @@ theObject(anObject), theP(aP) {} void operator ()() { (theObject->*theP)(); } - C *Object() const {return theObject;} + C *object() const {return theObject;} private: C *theObject; @@ -128,7 +128,7 @@ theObject(anObject), theP(aP), theArg1(anArg1) {} void operator ()() { (theObject->*theP)(theArg1); } - C *Object() const {return theObject;} + C *object() const {return theObject;} private: @@ -178,18 +178,17 @@ } } - AsyncCallBase(int debug_section, int debug_level, const char *callName): - theName(callName), debugSection(debug_section), debugLevel(debug_level){} + AsyncCallBase(int debugSection, int debugLevel, const char *callName): + theName(callName), theDebugSection(debugSection), theDebugLevel(debugLevel){} virtual ~AsyncCallBase() {} virtual bool fire() = 0; virtual void handleException(const TextException &e) = 0; virtual void end() = 0; protected: - virtual AsyncJob *theObject() = 0; const char *theName; - int debugSection; - int debugLevel; + int theDebugSection; + int theDebugLevel; }; // Same as AsyncCall, but does not assume the object is cbdata-protected. @@ -215,14 +214,15 @@ class JobCall: public AsyncCallBase { public: - JobCall(int debug_section, int debug_level, const char *callName): - AsyncCallBase(debug_section, debug_level, callName){} + JobCall(int debugSection, int debugLevel, const char *callName): + AsyncCallBase(debugSection, debugLevel, callName){} virtual bool fire(); virtual void handleException(const TextException &e); virtual void end(); protected: virtual void callJob() = 0; + virtual AsyncJob *job() = 0; }; // This template combines member function pointer calling ability of MemFunT @@ -232,16 +232,16 @@ class JobCallT: public JobCall { public: - JobCallT(const Dialer &aDialer,int debug_section, int debug_level, const char *callName): - JobCall(debug_section, debug_level, callName), theDialer(aDialer) + JobCallT(const Dialer &aDialer,int debugSection, int debugLevel, const char *callName): + JobCall(debugSection, debugLevel, callName), theDialer(aDialer) { AsyncJob *job = dynamic_cast(aDialer.Object()); cbdataReference(job->toCbdata()); } protected: - virtual void callJob() { debugs(debugSection, debugLevel, HERE << "dialing "<< theName); theDialer(); } - virtual AsyncJob *theObject() {return dynamic_cast(theDialer.Object());} + virtual void callJob() { debugs(theDebugSection, theDebugLevel, HERE << "dialing "<< theName); theDialer(); } + virtual AsyncJob *job() {return dynamic_cast(theDialer.object());} private: Dialer theDialer; }; @@ -251,9 +251,9 @@ // a templated function than to create a templated object. // We need one function for each *MemFunT template. template -JobCall *jobCall(const Dialer &dialer,int debug_section, int debug_level, const char *callName) +JobCall *jobCall(const Dialer &dialer,int debugSection, int debugLevel, const char *callName) { - return new JobCallT(dialer, debug_section, debug_level, callName); + return new JobCallT(dialer, debugSection, debugLevel, callName); } template bool CallJob(int debugSection, int debugLevel, const char *fileName, int fileLine, const char *callName, const Dialer &dialer){