Esempio n. 1
0
bool OriginalField::is_renamed() {
  if (ROM::get_original_fields(_ic) == NULL) {
    return false;
  }

  ConstantPool::Raw orig_cp = ROM::alternate_constant_pool(_ic);
  Symbol::Raw orig_name = orig_cp().symbol_at(_name_index);

  TypeArray::Raw new_fields = _ic->fields();
  ConstantPool::Raw new_cp = _ic->constants();

  int len = new_fields().length();
  for (int i=0; i<len; i+=5) {
    int name_index = new_fields().ushort_at(i + Field::NAME_OFFSET);
#if ENABLE_ISOLATES
    // IMPL_NOTE: this should be removed once ConstantPoolRewriter::rewrite_index()
    // is fixed.
    if (name_index == 0) {
      return true;
    }
#endif
    Symbol::Raw new_name = new_cp().symbol_at(name_index);
    if (new_name.equals(&orig_name)) {
      return false;
    }
  }

  return true;
}
Esempio n. 2
0
	void CRefresher::deal(workbench_t &bench)
	{
		char * tmp;
		tmp = create_cp(bench);
		string new_cp(tmp);
		
		bool changed = false;
		int old_timeout = bench.timeout;
#ifndef _TEST
		//if there is no url=bench.url in our file, we write delete log too
		if (bench.reply.status.code == 404)	
		{
			time_t timep;
			time(&timep);
//			fprintf(deletelog,"delete url %s %s\n",
//				bench.url->str().c_str(), ctime(&timep));
		return;
	}
#endif
	if (bench.timeout == 0)
	{
		changed = true;	//first time crawled
		time_t timep;
		time(&timep);
//		fprintf(newlog,"new url %s %s\n",
//			bench.url->str().c_str(), ctime(&timep));
	}
	else{
		if (new_cp != bench.checkpoint)
		{				//changed
			changed = true;
	
			time_t timep;
			time(&timep);
//			fprintf(changelog,"change url %s %s\n",
//				bench.url->str().c_str(), ctime(&timep));
		}
	}
	
	bench.changed = changed;	
	bench.timeout = rconfig.calculate(bench.url.str().c_str(),old_timeout,changed,bench.depth);
	
	CTime_struct real_time = get_real_time(bench.timeout);
#ifdef _TEST
	cout << "new real_time = " << real_time.time_to_string() << endl;
#endif
	
#ifndef _TEST
	bench.checkpoint = new_cp;
#endif

	save_to_file(bench,real_time);
}