org.chromium.sdk/src/org/chromium/sdk/internal/tools/v8/request/ContinueMessage.java
changeset 2 e4420d2515f1
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.EnumMap;
       
     8 import java.util.Map;
       
     9 
       
    10 import org.chromium.sdk.DebugContext.StepAction;
       
    11 import org.chromium.sdk.internal.tools.v8.DebuggerCommand;
       
    12 
       
    13 /**
       
    14  * Represents a "continue" V8 request message.
       
    15  */
       
    16 public class ContinueMessage extends DebuggerMessage {
       
    17 
       
    18   private static final Map<StepAction, String> stepActionToV8 =
       
    19       new EnumMap<StepAction, String>(StepAction.class);
       
    20 
       
    21   static {
       
    22     stepActionToV8.put(StepAction.IN, "in");
       
    23     stepActionToV8.put(StepAction.OUT, "out");
       
    24     stepActionToV8.put(StepAction.OVER, "next");
       
    25     stepActionToV8.put(StepAction.CONTINUE, null);
       
    26   }
       
    27 
       
    28   /**
       
    29    * @param stepAction the kind of step to perform
       
    30    * @param stepCount nullable number of steps to perform (positive if not null).
       
    31    *        Default is 1 step. Not used when {@code stepAction == CONTINUE}
       
    32    */
       
    33   public ContinueMessage(StepAction stepAction, Integer stepCount) {
       
    34     super(DebuggerCommand.CONTINUE.value);
       
    35     String stepActionString = stepActionToV8.get(stepAction);
       
    36     if (stepActionString != null) {
       
    37       putArgument("stepaction", stepActionString);
       
    38       putArgument("stepcount", stepCount);
       
    39     }
       
    40   }
       
    41 }