static string deviceName2topologyPath( string device, enum DeviceType & outType ) { ///@todo TODO: Currently we handle only "sd" and "hd" devices and partitions. Extend to all block devices listed in https://www.kernel.org/doc/Documentation/devices.txt . outType = DEVICE_TYPE_VIRTUAL; if( isPrefixed( "sd", device ) || isPrefixed( "hd", device ) ) { //We have an IDE or SCSI device, possibly with a partition number. assert( device.size() >= 3 && device[2] >= 'a' && device[2] <= 'z' ); std::ostringstream path; path << "@localhost/" << device[0] << "d:" << device[2] << ":block-device"; outType = DEVICE_TYPE_PHYSICAL; if( device.size() == 3 ) return path.str(); //It's a whole device //It's a partition for( size_t i = device.size(); i-->3; ) assert( device[i] >= '0' && device[i] <= '9' ); path << "/partition:" << &device.c_str()[3]; outType = DEVICE_TYPE_PHYSICAL_INDIVIDUAL_IGNORE; return path.str(); } if ( isPrefixed( "dm-", device ) ){ device = "dm" + device.substr(3); outType = DEVICE_TYPE_VIRTUAL; } if ( isPrefixed( "ram", device ) ){ outType = DEVICE_TYPE_MEMORY; } //Handle devices of unknown format const char* prefix = "@localhost/"; const char* postfix = ":master"; char path[strlen( prefix ) + device.size() + strlen( postfix ) + 1]; //find the start of the device number size_t deviceNumberStart = device.size(); for(; deviceNumberStart-->1 && device[deviceNumberStart] <= '9' && device[deviceNumberStart] >= '0'; ) ; deviceNumberStart++; //put the ring path together if( deviceNumberStart == device.size() ) { //No device number, this is a master device //sprintf() is safe due to the way the array size was calculated. sprintf( path, "%s%s%s", prefix, device.c_str(), postfix ); } else { char* currChar = path; for( size_t i = 0; prefix[i]; i++ ) *currChar++ = prefix[i]; for( size_t i = 0; i < deviceNumberStart; i++ ) *currChar++ = device[i]; *currChar++ = ':'; for( size_t i = deviceNumberStart; i < device.size(); i++ ) *currChar++ = device[i]; *currChar++ = 0; } return string( path ); }
void Fullscreen::eventQueueTimerFired(TimerBase*) { HeapDeque<Member<Event>> eventQueue; m_eventQueue.swap(eventQueue); while (!eventQueue.isEmpty()) { Event* event = eventQueue.takeFirst(); Node* target = event->target()->toNode(); // If the element was removed from our tree, also message the // documentElement. if (!target->isConnected() && document()->documentElement()) { DCHECK(isPrefixed(event->type())); eventQueue.append( createEvent(event->type(), *document()->documentElement())); } target->dispatchEvent(event); } }
RefPtr<CSSCrossfadeValue> CSSCrossfadeValue::blend(const CSSCrossfadeValue& from, double progress) const { ASSERT(equalInputImages(from)); if (!m_cachedToImage || !m_cachedFromImage) return nullptr; auto fromImageValue = CSSImageValue::create(*m_cachedFromImage); auto toImageValue = CSSImageValue::create(*m_cachedToImage); double fromPercentage = from.m_percentageValue->doubleValue(); if (from.m_percentageValue->isPercentage()) fromPercentage /= 100.0; double toPercentage = m_percentageValue->doubleValue(); if (m_percentageValue->isPercentage()) toPercentage /= 100.0; auto percentageValue = CSSPrimitiveValue::create(blendFunc(fromPercentage, toPercentage, progress), CSSPrimitiveValue::CSS_NUMBER); return CSSCrossfadeValue::create(WTFMove(fromImageValue), WTFMove(toImageValue), WTFMove(percentageValue), from.isPrefixed() && isPrefixed()); }