// 初始化 bool CServerRoot::initialize(uint16 uServerID) { // 日志初始化 char logprev[ 256 ] = { 0 }; dSprintf( logprev, sizeof( logprev ), "%s_%u", "test_log_", uServerID ); CLog::initialize( NULL, logprev ); // 这里必须在CLog::initilize之后 // 守护进程 TODO if(m_bInitFlag) return true; ::srand((uint32)getTime()); // 设置随机种子 m_uServerID = uServerID; // 设置服务器id // load 服务器配置 if(!loadConfig()){ CLog::error("配置文件装载失败!..."); return false; } if(!initEvent()){ CLog::error("事件初始失败!..."); return false; } installBreakHandlers(); m_tmStartTime = getTime(); m_bInitFlag = true; return true; }
/* virtual */ int DOM_MutationEvent::initMutationEvent(DOM_Object* this_object, ES_Value* argv, int argc, ES_Value* return_value, DOM_Runtime* origining_runtime) { DOM_THIS_OBJECT(event, DOM_TYPE_MUTATIONEVENT, DOM_MutationEvent); DOM_CHECK_ARGUMENTS("sbbOsssn"); int result = initEvent(this_object, argv, argc, return_value, origining_runtime); if (result != ES_FAILED) return result; if (event->known_type < DOMSUBTREEMODIFIED || event->known_type > DOMCHARACTERDATAMODIFIED) return ES_FAILED; // If it's ok to set the related_node to NULL if the below isn't true, then // we can remove the check and leave it all to the macro. if (argv[3].type == VALUE_OBJECT) DOM_ARGUMENT_OBJECT_EXISTING(event->related_node, 3, DOM_TYPE_NODE, DOM_Node); int attrChange = TruncateDoubleToInt(argv[7].value.number); if (attrChange == ADDITION) event->attr_change = ADDITION; else if (attrChange == REMOVAL) event->attr_change = REMOVAL; else event->attr_change = MODIFICATION; if (!(event->prev_value = UniSetNewStr(argv[4].value.string)) || !(event->new_value = UniSetNewStr(argv[5].value.string)) || !(event->attr_name = UniSetNewStr(argv[6].value.string))) return ES_NO_MEMORY; return ES_FAILED; }
/** * @brief Create an event * * Note that creating a CRASH event using this constructor will default to a crash * with Primary #0 and a minimum acceptable distance of zero; to specify a different * primary and miss distance, use the customizable constructor. * * @param t the event type * @param dir direction (+/-/both) the event will trigger on. +1 indicates (+) * direction, -1 (-) direction, and 0 both directions. * @param willStop whether or not this event should stop the integration * @throws Exception if this constructor is called for an event type that requires data * @throws Exception if the event type is not recognized */ void Event::createEvent(Event_tp t, int dir, bool willStop){ switch(t){ case Event_tp::SIM_TOF: case Event_tp::SIM_COMPTIME: case Event_tp::SIM_ERR: case Event_tp::YZ_PLANE: case Event_tp::XZ_PLANE: case Event_tp::XY_PLANE: case Event_tp::CRASH: case Event_tp::MASS: { std::vector<double> params {0}; initEvent(t, dir, willStop, params); break; } case Event_tp::ANGLE_PLANE_P1: case Event_tp::STATE_PLANE: case Event_tp::JC: case Event_tp::APSE: case Event_tp::DIST: throw Exception("Event_tp::Event: Cannot create this type of event without parameter data..."); default: throw Exception("Event_tp::Event: Creating event with no type"); } }//===================================================
void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData) { if (dispatched()) return; initEvent(type, bubbles, cancelable); m_deviceMotionData = deviceMotionData; }
void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData* orientation) { if (dispatched()) return; initEvent(type, bubbles, cancelable); m_orientation = orientation; }
void ConfigFileTestApp::sendInitEvents() { boost::shared_ptr<CommonInitEvent> initEvent(new CommonInitEvent()); initEvent->mediaCommon = configFileTest.get(); initEvent->configFile = configFile; configFileTest->queue_event(initEvent); configFile->queue_event(initEvent); }
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, ScriptValue detail) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_detail = detail; }
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> serializedDetail) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_serializedDetail = serializedDetail; }
void PopStateEvent::initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> stateObject) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_stateObject = stateObject; }
void PopStateEvent::initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& state) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_state = state; }
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& detail) { ASSERT(!m_serializedScriptValue.get()); if (dispatched()) return; initEvent(type, canBubble, cancelable); m_detail = detail; }
void MutationEvent::initMutationEvent(const XMLString& type, bool canBubble, bool cancelable, Node* relatedNode, const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change) { initEvent(type, canBubble, cancelable); m_pRelatedNode = relatedNode; m_prevValue = prevValue; m_newValue = newValue; m_attrName = attrName; m_change = change; }
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> serializedScriptValue) { ASSERT(m_detail.hasNoValue()); if (dispatched()) return; initEvent(type, canBubble, cancelable); m_serializedScriptValue = serializedScriptValue; }
void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, AbstractView* viewArg, int detailArg) { if (dispatched()) return; initEvent(typeArg, canBubbleArg, cancelableArg); m_view = viewArg; m_detail = detailArg; }
void UIEvent::initUIEventInternal(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg) { if (dispatched()) return; initEvent(typeArg, canBubbleArg, cancelableArg); m_view = viewArg; m_detail = detailArg; m_sourceCapabilities = sourceCapabilitiesArg; }
void ErrorEvent::initErrorEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& message, const String& fileName, unsigned lineNumber) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_message = message; m_fileName = fileName; m_lineNumber = lineNumber; }
void UIEvent::initUIEventInternal(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget, AbstractView* viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg) { if (isBeingDispatched()) return; initEvent(typeArg, canBubbleArg, cancelableArg, relatedTarget); m_view = viewArg; m_detail = detailArg; m_sourceCapabilities = sourceCapabilitiesArg; }
void UIEventImp::initUIEvent( DOMString typeArg, bool canBubbleArg, bool cancelableArg, AbstractView * viewArg, long detailArg) { initEvent(typeArg, canBubbleArg, cancelableArg); view_ = viewArg; detail_ = detailArg; }
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const Deprecated::ScriptValue& detail) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_detail = detail; m_serializedDetail = nullptr; m_triedToSerialize = false; }
void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow) { if (dispatched()) return; initEvent(eventNames().overflowchangedEvent, false, false); m_orient = orient; m_horizontalOverflow = horizontalOverflow; m_verticalOverflow = verticalOverflow; }
void CustomEvent::initCustomEvent(JSC::ExecState& state, const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue detail) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_detail = { state.vm(), detail }; m_serializedDetail = nullptr; m_triedToSerialize = false; }
void PageTransitionEvent::initPageTransitionEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, bool persisted) { if (dispatched()) return; initEvent(type, canBubbleArg, cancelableArg); m_persisted = persisted; }
void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData) { if (dispatched()) return; initEvent(type, bubbles, cancelable); m_deviceMotionData = deviceMotionData; m_acceleration.clear(); m_accelerationIncludingGravity.clear(); m_rotationRate.clear(); }
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray> ports) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_dataType = DataTypeScriptValue; m_origin = origin; m_lastEventId = lastEventId; m_source = source; m_ports = ports; }
void WebKitAnimationEvent::initWebKitAnimationEvent(const AtomicString& type, bool /*canBubbleArg*/, bool /*cancelableArg*/, const String& animationName, double elapsedTime) { if (dispatched()) return; initEvent(type, false, true); m_animationName = animationName; }
void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_key = key; m_oldValue = oldValue; m_newValue = newValue; m_url = url; m_storageArea = storageArea; }
void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& uri, PassRefPtr<DOMWindow> source, Storage* storageArea) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_key = key; m_oldValue = oldValue; m_newValue = newValue; m_uri = uri; m_source = source; m_storageArea = storageArea; }
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, std::unique_ptr<MessagePortArray> ports) { if (dispatched()) return; initEvent(type, canBubble, cancelable); m_dataType = DataTypeSerializedScriptValue; m_dataAsSerializedScriptValue = data; m_origin = origin; m_lastEventId = lastEventId; m_source = source; m_ports = WTFMove(ports); }
void DeviceOrientationEvent::initDeviceOrientationEvent( const AtomicString& type, bool bubbles, bool cancelable, const Nullable<double>& alpha, const Nullable<double>& beta, const Nullable<double>& gamma, bool absolute) { if (isBeingDispatched()) return; initEvent(type, bubbles, cancelable); m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute); }
bool P003::init() { if (!PBase::init()) { return false; } initSceneJson("game/json/P003.json"); initEvent(); initScrollLayer(); return true; }