org.chromium.sdk/src/org/chromium/sdk/internal/tools/v8/request/SetBreakpointMessage.java
changeset 2 e4420d2515f1
child 355 8726e95bcbba
equal deleted inserted replaced
1:ef76fc2ac88c 2:e4420d2515f1
       
     1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
       
     2 // Use of this source code is governed by a BSD-style license that can be
       
     3 // found in the LICENSE file.
       
     4 
       
     5 package org.chromium.sdk.internal.tools.v8.request;
       
     6 
       
     7 import java.util.HashMap;
       
     8 import java.util.Map;
       
     9 
       
    10 import org.chromium.sdk.Breakpoint;
       
    11 import org.chromium.sdk.internal.tools.v8.DebuggerCommand;
       
    12 
       
    13 /**
       
    14  * Represents a "setbreakpoint" V8 request message.
       
    15  */
       
    16 public class SetBreakpointMessage extends ContextlessDebuggerMessage {
       
    17 
       
    18   private static final Map<Breakpoint.Type, String> typeToV8Type =
       
    19       new HashMap<Breakpoint.Type, String>();
       
    20 
       
    21   static {
       
    22     typeToV8Type.put(Breakpoint.Type.FUNCTION, "function");
       
    23     typeToV8Type.put(Breakpoint.Type.SCRIPT_NAME, "script");
       
    24     typeToV8Type.put(Breakpoint.Type.SCRIPT_ID, "scriptId");
       
    25   }
       
    26 
       
    27   /**
       
    28    * @param type ("function", "handle", or "script")
       
    29    * @param target function expression, script identification, or handle decimal number
       
    30    * @param line in the script or function
       
    31    * @param position of the target start within the line
       
    32    * @param enabled whether the breakpoint is enabled initially. Nullable, default is true
       
    33    * @param condition nullable string with breakpoint condition
       
    34    * @param ignoreCount nullable number specifying the amount of break point hits to ignore.
       
    35    *        Default is 0
       
    36    */
       
    37   public SetBreakpointMessage(Breakpoint.Type type, String target,
       
    38       Integer line, Integer position, Boolean enabled, String condition,
       
    39       Integer ignoreCount) {
       
    40     super(DebuggerCommand.SETBREAKPOINT.value);
       
    41     putArgument("type", typeToV8Type.get(type));
       
    42     putArgument("target", target);
       
    43     putArgument("line", line);
       
    44     putArgument("position", position);
       
    45     putArgument("enabled", enabled);
       
    46     putArgument("condition", condition);
       
    47     putArgument("ignoreCount", ignoreCount);
       
    48   }
       
    49 }