当前位置: 首页>>代码示例>>C++>>正文


C++ TryCatch::Reset方法代码示例

本文整理汇总了C++中TryCatch::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ TryCatch::Reset方法的具体用法?C++ TryCatch::Reset怎么用?C++ TryCatch::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TryCatch的用法示例。


在下文中一共展示了TryCatch::Reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UserInvoke

int Interface::UserInvoke(JNIEnv *jniEnv, Handle<Object> target, int opIdx, jobjectArray jArgs, jobject *jResult) {
  HandleScope scope;
  TryCatch tryCatch;
  Operation *op = operations->addr(opIdx);
  int result = OK;
  for(int i = 0; result == OK && i < op->argCount; i++) {
      result = conv->ToV8Value(jniEnv, jniEnv->GetObjectArrayElement(jArgs, i), op->argTypes[i], &op->vArgs[i]);
  }
  if(result == OK) {
    Handle<Value> vRes;
    if(target->IsFunction() && parent == 0 && operations->getLength() == 1) {
      /* invoke as function if target is a function, and interface delcares only one operation */
      vRes = (Handle<Function>::Cast(target))->Call(target, op->argCount, op->vArgs);
    } else {
      /* locate the method and invoke that */
      Handle<Value> vMethod = target->Get(op->name);
      if(!vMethod.IsEmpty() && vMethod->IsFunction()) {
        vRes = Handle<Function>::Cast(vMethod)->Call(target, op->argCount, op->vArgs);
      }
    }
    if(!vRes.IsEmpty() && op->type != TYPE_UNDEFINED) {
      jobject ob;
      result = conv->ToJavaObject(jniEnv, vRes, op->type, &ob);
      if(result == OK) {
        *jResult = ob;
      }
    }
  }
  if(tryCatch.HasCaught()) {
    result = ErrorJS;
    tryCatch.Reset();
  }
  return result;
}
开发者ID:amolmk,项目名称:anode,代码行数:34,代码来源:Interface.cpp

示例2: UserSet

int Interface::UserSet(JNIEnv *jniEnv, Handle<Object> target, int attrIdx, jobject jVal) {
  HandleScope scope;
  TryCatch tryCatch;
  Attribute *attr = attributes->addr(attrIdx);
  Handle<Value> val;
  int result = conv->ToV8Value(jniEnv, jVal, attr->type, &val);
  if(result == OK) {
    target->Set(attr->name, val);
  }
  if(tryCatch.HasCaught()) {
    result = ErrorJS;
    tryCatch.Reset();
  }
  return result;
}
开发者ID:amolmk,项目名称:anode,代码行数:15,代码来源:Interface.cpp

示例3: UserGet

int Interface::UserGet(JNIEnv *jniEnv, Handle<Object> target, int attrIdx, jobject *jVal) {
  HandleScope scope;
  TryCatch tryCatch;
  Attribute *attr = attributes->addr(attrIdx);
  Handle<Value> val = target->Get(attr->name);
  if(tryCatch.HasCaught()) {
    tryCatch.Reset();
    return ErrorJS;
  }
  jobject ob;
  int result = conv->ToJavaObject(jniEnv, val, attr->type, &ob);
  if(result == OK) {
    *jVal = ob;
  }
  return result;
}
开发者ID:amolmk,项目名称:anode,代码行数:16,代码来源:Interface.cpp

示例4: test1

void test1(cv::Shell & shell)
{
    using namespace v8;
    HandleScope scope;
    bind_MyType( shell.Global() );

    if(1)
    {
        Handle<Function> hf = FunctionTemplate::New(test1_callback)->GetFunction();
        Handle<Value> args[] = {
            Integer::New(3),
            Number::New(5.1),
            Undefined()
        };
        CERR << "Calling binding function...\n";
        TryCatch catcher;
        hf->Call( shell.Context()->Global(), 3, args );
        catcher.Reset();
        CERR << "Returned from binding function.\n";
    }
    else
    {
        BoundNative::SetupBindings( shell.Global() );
    }

    char const * extScr = "./test.js";
    CERR << "Calling external script ["<<extScr<<"]...\n";
    if(1)
    {
        Local<Object> global( shell.Context()->Global() );
        assert( ! global.IsEmpty() );
        Local<Function> jf( Function::Cast( *(global->Get(JSTR("load"))) ) );
        assert( ! jf.IsEmpty() );
        cv::CallForwarder<1>::Call( global, jf, extScr );
    }
    else if(1)
    {
        shell.ExecuteFile( extScr );
    }
    CERR << "Returned from external script\n";
}
开发者ID:ColdenCullen,项目名称:V8-Convert,代码行数:41,代码来源:demo.cpp

示例5: eventLoop


//.........这里部分代码省略.........
            if (_ntq->Length() && !onError.HasCaught()) { //当有错误时,不执行异步
            
                  if ((++ctr) > 2e3) {
                      ctr= 0;
                      V8::IdleNotification();//强制GC
                  }

                  resultado = dispatchNextTicks->CallAsFunction(global, 0, NULL); //调用线程内的 nexttick
			
            }

            if (job->typeEval.tiene_callBack) { //如果执行任务具有回调函数
              //如果有错误,则 job->typeEval.error 是1,否则为0;
              job->typeEval.error= onError.HasCaught() ? 1 : 0; 
			  if(job->typeEval.error){
					 _ntq= Array::New();
			  }
              //如果有异常,则返回值 resultado 为异常内容,否则为函数返回内容
              job->typeEval.resultado= new String::Utf8Value(job->typeEval.error ? onError.Exception() : threadObject->Get(String::New("_TAGG_RES")));
              //执行完毕,将qtiem项丢入线程的出列队列
              queue_push(qitem, &thread->outQueue);
              // wake up callback
              //丢入异步队列

              uv_async_send(&thread->async_watcher);

            }
            else { //如果没有回调函数,则把改item丢入闲置任务队列
              queue_push(qitem, freeJobsQueue);
            }

            if (onError.HasCaught()){
				nextTickQueueLength= 1;
				onError.Reset(); //如果此次执行有错误,则清空
			}
			else{
				 nextTickQueueLength= resultado->NumberValue();
			}

     }//如果执行的任务


          else if (job->jobType == kJobTypeEvent) { //如果是事件的任务
            //Emitir evento.
            
            Local<Value> args[2]; //定义一个数组长度为2,保存 Local<Value> 类型的值
            str= job->typeEvent.eventName; //获得事件名字
            args[0]= String::New(**str, (*str).length()); //数组第一个保存event事件的名字,保存为local<string>类型
            delete str;
            
            Local<Array> array= Array::New(job->typeEvent.length);
            args[1]= array; //设置参数长度
            
            int i= 0;
            while (i < job->typeEvent.length) { //将参数保存入Local<Array>
              str= job->typeEvent.argumentos[i];
              array->Set(i, String::New(**str, (*str).length()));
              delete str;
              i++;
            }
            
            free(job->typeEvent.argumentos); //释放任务的 typeEvent 内存
            queue_push(qitem, freeJobsQueue); //将本项丢入闲置任务队列
            dispatchEvents->CallAsFunction(global, 2, args); //执行回调函数,并且加入参数
          
开发者ID:bamwang,项目名称:auto_scaling_for_node,代码行数:65,代码来源:threads_a_gogo.cpp


注:本文中的TryCatch::Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。