private void doSetInitialBreakpointsAndResume(@NotNull final IsolateRef isolateRef) {
    final Set<XLineBreakpoint<XBreakpointProperties>> xBreakpoints =
        myBreakpointHandler.getXBreakpoints();

    if (xBreakpoints.isEmpty()) {
      myIsolatesInfo.setBreakpointsSet(isolateRef);
      checkInitialResume(isolateRef);
      return;
    }

    final AtomicInteger counter = new AtomicInteger(xBreakpoints.size());

    for (final XLineBreakpoint<XBreakpointProperties> xBreakpoint : xBreakpoints) {
      addBreakpoint(
          isolateRef.getId(),
          xBreakpoint.getSourcePosition(),
          new VmServiceConsumers.BreakpointConsumerWrapper() {
            @Override
            void sourcePositionNotApplicable() {
              checkDone();
            }

            @Override
            public void received(Breakpoint vmBreakpoint) {
              myBreakpointHandler.vmBreakpointAdded(xBreakpoint, isolateRef.getId(), vmBreakpoint);
              checkDone();
            }

            @Override
            public void onError(RPCError error) {
              myBreakpointHandler.breakpointFailed(xBreakpoint);
              checkDone();
            }

            private void checkDone() {
              if (counter.decrementAndGet() == 0) {
                myIsolatesInfo.setBreakpointsSet(isolateRef);
                checkInitialResume(isolateRef);
              }
            }
          });
    }
  }
  public void addBreakpoint(
      @NotNull final String isolateId,
      @NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint,
      @NotNull final VmServiceConsumers.BreakpointConsumerWrapper consumer) {
    final XSourcePosition position = xBreakpoint.getSourcePosition();
    if (position == null || position.getFile().getFileType() != DartFileType.INSTANCE) {
      consumer.sourcePositionNotApplicable();
      return;
    }

    addRequest(
        new Runnable() {
          @Override
          public void run() {
            final String uri = myDebugProcess.getUriForFile(position.getFile());
            final int line = position.getLine() + 1;
            myVmService.addBreakpointWithScriptUri(isolateId, uri, line, consumer);
          }
        });
  }
  public void addBreakpointForIsolates(
      @NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint,
      @NotNull final Collection<IsolatesInfo.IsolateInfo> isolateInfos) {
    for (final IsolatesInfo.IsolateInfo isolateInfo : isolateInfos) {
      addBreakpoint(
          isolateInfo.getIsolateId(),
          xBreakpoint.getSourcePosition(),
          new VmServiceConsumers.BreakpointConsumerWrapper() {
            @Override
            void sourcePositionNotApplicable() {}

            @Override
            public void received(Breakpoint vmBreakpoint) {
              myBreakpointHandler.vmBreakpointAdded(
                  xBreakpoint, isolateInfo.getIsolateId(), vmBreakpoint);
            }

            @Override
            public void onError(RPCError error) {}
          });
    }
  }