1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** \file 18 This file consists of implementation of class AdbApiInstance that is a main 19 API object representing a device interface that is in the interest of 20 the API client. All device (interface) related operations go through this 21 class first. 22 */ 23 24 #include "stdafx.h" 25 #include "adb_api_instance.h" 26 #include "adb_helper_routines.h" 27 28 /// Map that holds all instances of this object 29 AdbApiInstanceMap adb_app_instance_map; 30 ULONG_PTR adb_app_instance_id = 0; 31 CComAutoCriticalSection adb_app_instance_map_locker; 32 AdbApiInstance()33AdbApiInstance::AdbApiInstance() 34 : ref_count_(1) { 35 // Generate inteface handle 36 adb_app_instance_map_locker.Lock(); 37 adb_app_instance_id++; 38 adb_app_instance_map_locker.Unlock(); 39 instance_handle_ = 40 reinterpret_cast<ADBAPIINSTANCEHANDLE>(adb_app_instance_id); 41 } 42 ~AdbApiInstance()43AdbApiInstance::~AdbApiInstance() { 44 } 45 LastReferenceReleased()46void AdbApiInstance::LastReferenceReleased() { 47 } 48