Package org.chromium.sdk

Examples of org.chromium.sdk.JsValue$ReloadBiggerCallback


    static Optional<PreviewContext> build(Value uiValue) {
      if (uiValue == null) {
        return createErrorOptional(new Message(Messages.LogicImpl_VALUE_IS_NOT_AVAILABLE,
                MessagePriority.BLOCKING_PROBLEM));
      }
      JsValue jsValue = uiValue.getJsValue();
      JsObject jsObject = jsValue.asObject();
      if (jsObject == null) {
        return createErrorOptional(
            new Message(Messages.LogicImpl_NOT_FOR_PRIMITIVE, MessagePriority.BLOCKING_PROBLEM));
      }
View Full Code Here


      }

      private ArrayProperties buildArrayProperties() throws MethodIsBlockingException {
        ObjectProperties loadedProperties = getLoadedProperties();
        final TreeMap<Long, JsVariable> map = new TreeMap<Long, JsVariable>();
        JsValue lengthValue = null;
        for (JsVariable variable : loadedProperties.properties()) {
          String name = variable.getName();
          Long index = JavaScriptExpressionBuilder.parsePropertyNameAsArrayIndex(name);
          if (index != null) {
            map.put(index, variable);
          } else if ("length".equals(name)) {
            lengthValue = variable.getValue();
          }
        }
        long length;
        try {
          length = Long.parseLong(lengthValue.getValueString());
        } catch (NumberFormatException e) {
          length = -1;
        }
        return new ArrayProperties(length, map);
      }
View Full Code Here

      ValueNameBuilder valueNameBuidler) {
    RemoteObjectValue valueData = getRemoteObjectValue(data);

    WipValueBuilder valueBuilder = destinationValueLoader.getValueBuilder();

    final JsValue value = valueBuilder.wrap(valueData, valueNameBuidler.getQualifiedNameBuilder());

    if (getWasThrown(data) == Boolean.TRUE) {
      return new ResultOrException() {
            @Override public JsValue getResult() {
              return null;
View Full Code Here

          exceptionRemoteObject =
              WipParserAccess.get().parseRemoteObjectValue(additionalDataObject);
        } catch (JsonProtocolParseException e) {
          throw new RuntimeException("Failed to parse exception data", e);
        }
        JsValue exceptionValue =
            valueLoader.getValueBuilder().wrap(exceptionRemoteObject, null);
        exceptionData = new ExceptionDataImpl(exceptionValue);
      } else {
        exceptionData = null;
      }
View Full Code Here

  }

  public JsObjectProperty createObjectProperty(final PropertyDescriptorValue propertyDescriptor,
      final String hostObjectRefId, ValueNameBuilder nameBuilder) {
    final QualifiedNameBuilder qualifiedNameBuilder = nameBuilder.getQualifiedNameBuilder();
    JsValue jsValue = wrap(propertyDescriptor.value(), qualifiedNameBuilder);

    final JsValue getter = wrapPropertyDescriptorFunction(propertyDescriptor.get(),
        qualifiedNameBuilder, "getter");

    final JsValue setter = wrapPropertyDescriptorFunction(propertyDescriptor.set(),
        qualifiedNameBuilder, "setter");

    return new ObjectPropertyBase(jsValue, nameBuilder) {
      @Override public JsDeclarativeVariable asDeclarativeVariable() {
        return null;
View Full Code Here

    if (nameBuilder == null) {
      qualifiedNameBuilder = null;
    } else {
      qualifiedNameBuilder = nameBuilder.getQualifiedNameBuilder();
    }
    JsValue jsValue = wrap(valueData, qualifiedNameBuilder);
    return createVariable(jsValue, nameBuilder);
  }
View Full Code Here

    if (nameBuilder == null) {
      qualifiedNameBuilder = null;
    } else {
      qualifiedNameBuilder = nameBuilder.getQualifiedNameBuilder();
    }
    JsValue jsValue = wrap(valueData, qualifiedNameBuilder);
    return new DeclarativeVariable(jsValue, nameBuilder);
  }
View Full Code Here

    checkElementData(thirdElement);
  }

  private static void checkElementData(JsVariable arrayElement) {
    assertNotNull(arrayElement);
    JsValue value = arrayElement.getValue();
    assertEquals(JsValue.Type.TYPE_NUMBER, value.getType());
    assertEquals("3", value.getValueString());
  }
View Full Code Here

    };

    suspendContext.getGlobalEvaluateContext().evaluateSync("#long_value", null, evaluateCallback);
    assertNotNull(expressionResult[0]);

    JsValue value = expressionResult[0];
    assertTrue(value.isTruncated());
    String shortValue = value.getValueString();

    final boolean[] reloadResult = { false } ;
    JsValue.ReloadBiggerCallback callback = new JsValue.ReloadBiggerCallback() {
      public void done() {
        reloadResult[0] = true;
      }
    };
    CallbackSemaphore semaphore = new CallbackSemaphore();
    RelayOk relayOk = value.reloadHeavyValue(callback, semaphore);
    semaphore.acquireDefault(relayOk);
    assertTrue(reloadResult[0]);

    String reloadedValue = value.getValueString();

    assertTrue(shortValue.length() < reloadedValue.length());
  }
View Full Code Here

          exceptionRemoteObject =
              WipParserAccess.get().parseRemoteObjectValue(additionalDataObject);
        } catch (JsonProtocolParseException e) {
          throw new RuntimeException("Failed to parse exception data", e);
        }
        JsValue exceptionValue =
            valueLoader.getValueBuilder().wrap(exceptionRemoteObject);
        exceptionData = new ExceptionDataImpl(exceptionValue);
      } else {
        exceptionData = null;
      }
View Full Code Here

TOP

Related Classes of org.chromium.sdk.JsValue$ReloadBiggerCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.