Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "CSFLog.h" |
michael@0 | 6 | |
michael@0 | 7 | #include "CC_Common.h" |
michael@0 | 8 | |
michael@0 | 9 | #include "CC_SIPCCLine.h" |
michael@0 | 10 | #include "CC_SIPCCCall.h" |
michael@0 | 11 | #include "CC_SIPCCLineInfo.h" |
michael@0 | 12 | |
michael@0 | 13 | extern "C" |
michael@0 | 14 | { |
michael@0 | 15 | #include "ccapi_line.h" |
michael@0 | 16 | #include "ccapi_line_listener.h" |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | using namespace std; |
michael@0 | 20 | using namespace CSF; |
michael@0 | 21 | |
michael@0 | 22 | CSF_IMPLEMENT_WRAP(CC_SIPCCLine, cc_lineid_t); |
michael@0 | 23 | |
michael@0 | 24 | cc_lineid_t CC_SIPCCLine::getID() |
michael@0 | 25 | { |
michael@0 | 26 | return lineId; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | CC_LineInfoPtr CC_SIPCCLine::getLineInfo () |
michael@0 | 30 | { |
michael@0 | 31 | cc_lineinfo_ref_t lineInfoRef = CCAPI_Line_getLineInfo(lineId); |
michael@0 | 32 | CC_LineInfoPtr lineInfoPtr = CC_SIPCCLineInfo::wrap(lineInfoRef).get(); |
michael@0 | 33 | |
michael@0 | 34 | //A call to CCAPI_Line_getLineInfo() needs a matching call to CCAPI_Line_releaseLineInfo() |
michael@0 | 35 | //However, the CC_SIPCCLineInfo() ctor/dtor does a retain/release internally, so I need to explicitly release |
michael@0 | 36 | //here to match up with the call to CCAPI_Line_getLineInfo(). |
michael@0 | 37 | |
michael@0 | 38 | CCAPI_Line_releaseLineInfo(lineInfoRef); |
michael@0 | 39 | |
michael@0 | 40 | //CCAPI_Line_getLineInfo() --> requires release be called. |
michael@0 | 41 | //CC_SIPCCLineInfo::CC_SIPCCLineInfo() -> Call retain (wrapped in smart_ptr) |
michael@0 | 42 | //CCAPI_Line_releaseLineInfo() --> this maps to the call to CCAPI_Line_getLineInfo() |
michael@0 | 43 | //CC_SIPCCLineInfo::~CC_SIPCCLineInfo() --> CCAPI_Line_releaseLineInfo() (when smart pointer destroyed) |
michael@0 | 44 | |
michael@0 | 45 | return lineInfoPtr; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | CC_CallPtr CC_SIPCCLine::createCall () |
michael@0 | 49 | { |
michael@0 | 50 | cc_call_handle_t callHandle = CCAPI_Line_CreateCall(lineId); |
michael@0 | 51 | |
michael@0 | 52 | return CC_SIPCCCall::wrap(callHandle).get(); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 |