Home | History | Annotate | Download | only in ddm
      1 /*
      2  * Copyright (C) 2007 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 package android.ddm;
     18 
     19 import org.apache.harmony.dalvik.ddmc.DdmServer;
     20 import android.util.Log;
     21 
     22 /**
     23  * Just a place to stick handler registrations, instead of scattering
     24  * them around.
     25  */
     26 public class DdmRegister {
     27 
     28     private DdmRegister() {}
     29 
     30     /**
     31      * Register handlers for all known chunk types.
     32      *
     33      * If you write a handler, add a registration call here.
     34      *
     35      * Note that this is invoked by the application (usually through a
     36      * static initializer in the main class), not the VM.  It's done this
     37      * way so that the handlers can use Android classes with native calls
     38      * that aren't registered until after the VM is initialized (e.g.
     39      * logging).  It also allows debugging of DDM handler initialization.
     40      *
     41      * The chunk dispatcher will pause until we call registrationComplete(),
     42      * so that we don't have a race that causes us to drop packets before
     43      * we finish here.
     44      */
     45     public static void registerHandlers() {
     46         if (false)
     47             Log.v("ddm", "Registering DDM message handlers");
     48         DdmHandleHello.register();
     49         DdmHandleThread.register();
     50         DdmHandleHeap.register();
     51         DdmHandleNativeHeap.register();
     52         DdmHandleProfiling.register();
     53         DdmHandleExit.register();
     54         DdmHandleViewDebug.register();
     55 
     56         DdmServer.registrationComplete();
     57     }
     58 }
     59 
     60