Skip to content

Commit

Permalink
4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneWeird committed Oct 19, 2017
1 parent a551727 commit d50d974
Show file tree
Hide file tree
Showing 1,928 changed files with 72,629 additions and 45,764 deletions.
7 changes: 6 additions & 1 deletion WKC/WTF/wtf/WKC/RunLoopWKC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 ACCESS CO., LTD. All rights reserved.
* Copyright (C) 2015-2017 ACCESS CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -77,10 +77,15 @@ RunLoop::TimerBase::TimerBase(RunLoop& runLoop)
, m_nextFireInterval(0)
{
m_timer = wkcTimerNewPeer();
if (!m_timer)
CRASH();
}

RunLoop::TimerBase::~TimerBase()
{
if (!m_timer)
return;

stop();
wkcTimerDeletePeer(m_timer);
}
Expand Down
7 changes: 4 additions & 3 deletions WKC/WTF/wtf/WKC/wkcmutex.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2016 ACCESS CO., LTD. All rights reserved.
* Copyright (C) 2015-2017 ACCESS CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -126,7 +126,8 @@ WTF_MAKE_FAST_ALLOCATED;
m_locked = m_lock.try_lock();
return m_locked;
}
inline bool try_lock_for(const std::chrono::duration<std::milli>& timeout)
// WORKAROUND : compile error has occurred with -fdelayed-template-parsin.
/*inline bool try_lock_for(const std::chrono::duration<std::milli>& timeout)
{
if (!m_have_lock)
return false;
Expand All @@ -144,7 +145,7 @@ WTF_MAKE_FAST_ALLOCATED;
} while (1);
m_locked = false;
return false;
}
}*/
inline void unlock()
{
m_lock.unlock();
Expand Down
48 changes: 32 additions & 16 deletions WKC/WebCore/platform/WKC/CryptoKeyWKC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2015-2017 ACCESS CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -61,6 +61,10 @@
#include <openssl/hmac.h>
#include <openssl/rsa.h>
#include <openssl/sha.h>
#include <openssl/ossl_typ.h>
#include <openssl/rsa_locl.h>
#include <openssl/bn_lcl.h>
#include <openssl/hmac_lcl.h>

#if ENABLE(SUBTLE_CRYPTO)

Expand Down Expand Up @@ -115,9 +119,8 @@ CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, const CryptoKeyDataRS
rsa->q = pq;
if (type==CryptoKeyType::Private) {
BN_CTX* ctx = 0;
BIGNUM one;
BN_init(&one);
BN_set_word(&one, 1);
BIGNUM* one = BN_new();
BN_set_word(one, 1);
rsa->dmp1 = BN_new();
rsa->dmq1 = BN_new();
rsa->iqmp = BN_new();
Expand All @@ -126,10 +129,11 @@ CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, const CryptoKeyDataRS
ctx = BN_CTX_new();
if (!ctx)
goto error_end;
BN_mod_sub(rsa->dmp1, pexp, pp, &one, ctx);
BN_mod_sub(rsa->dmq1, pexp, pq, &one, ctx);
BN_sqr(&one, pq, ctx);
BN_mod(rsa->iqmp, &one, pp, ctx);
BN_mod_sub(rsa->dmp1, pexp, pp, one, ctx);
BN_mod_sub(rsa->dmq1, pexp, pq, one, ctx);
BN_sqr(one, pq, ctx);
BN_mod(rsa->iqmp, one, pp, ctx);
BN_free(one);
BN_CTX_free(ctx);
} else {
rsa->dmp1 = 0;
Expand Down Expand Up @@ -189,10 +193,22 @@ std::unique_ptr<CryptoKeyData>
CryptoKeyRSA::exportData() const
{
RSA* rsa = (RSA *)m_platformKey;
Vector<uint8_t> v(BN_num_bytes(rsa->e));
int len = BN_bn2bin(rsa->e, v.data());
std::unique_ptr<CryptoKeyData> ret(new CryptoKeyDataOctetSequence(v));
return ret;
const BIGNUM* n = 0;
const BIGNUM* e = 0;
const BIGNUM* d = 0;
RSA_get0_key(rsa, &n, &e, &d);
if (!n || !e)
return nullptr;
Vector<uint8_t> modulus(BN_num_bytes(n));
Vector<uint8_t> exponent(BN_num_bytes(e));
if (!d) {
// Public key
return CryptoKeyDataRSAComponents::createPublic(modulus, exponent);
} else {
// Private key
Vector<uint8_t> privateExponent(BN_num_bytes(d));
return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent);
}
}

void
Expand Down Expand Up @@ -335,9 +351,9 @@ CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParams& params, con
HMAC_CTX ctx;
unsigned int len=0;
unsigned char buf[EVP_MAX_MD_SIZE];
HMAC_CTX_init(&ctx);
HMAC_CTX_reset(&ctx);

int ret = HMAC_Init(&ctx, key.key().data(), key.key().size(), EVP_sha256());
int ret = HMAC_Init_ex(&ctx, key.key().data(), key.key().size(), EVP_sha256(), NULL);
if (!ret)
goto error_end;
ret = HMAC_Update(&ctx, data.first, data.second);
Expand All @@ -346,14 +362,14 @@ CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParams& params, con
ret = HMAC_Final(&ctx, buf, &len);
if (!ret)
goto error_end;
HMAC_CTX_cleanup(&ctx);
HMAC_CTX_reset(&ctx);
success(true);
return;

error_end:
ec = ABORT_ERR;
failureCallback();
HMAC_CTX_cleanup(&ctx);
HMAC_CTX_reset(&ctx);
return;
}

Expand Down
24 changes: 12 additions & 12 deletions WKC/WebCore/platform/WKC/MediaControlsWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,69 +94,69 @@ bool MediaControlsWKC::initializeControls(Document& document)

RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonElement::create(document);
m_playButton = playButton.get();
panel->appendChild(playButton.release(), exceptionCode);
panel->appendChild(playButton.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::create(document, this);
m_timeline = timeline.get();
panel->appendChild(timeline.release(), exceptionCode);
panel->appendChild(timeline.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaControlCurrentTimeDisplayElement::create(document);
m_currentTimeDisplay = currentTimeDisplay.get();
m_currentTimeDisplay->hide();
panel->appendChild(currentTimeDisplay.release(), exceptionCode);
panel->appendChild(currentTimeDisplay.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaControlTimeRemainingDisplayElement::create(document);
m_durationDisplay = durationDisplay.get();
panel->appendChild(durationDisplay.release(), exceptionCode);
panel->appendChild(durationDisplay.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

if (document.page()->theme().supportsClosedCaptioning()) {
RefPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClosedCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(document, this);
m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get();
panel->appendChild(toggleClosedCaptionsButton.release(), exceptionCode);
panel->appendChild(toggleClosedCaptionsButton.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;
}

RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlFullscreenButtonElement::create(document);
m_fullScreenButton = fullscreenButton.get();
panel->appendChild(fullscreenButton.release(), exceptionCode);
panel->appendChild(fullscreenButton.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

RefPtr<MediaControlPanelMuteButtonElement> panelMuteButton = MediaControlPanelMuteButtonElement::create(document, this);
m_panelMuteButton = panelMuteButton.get();
panel->appendChild(panelMuteButton.release(), exceptionCode);
panel->appendChild(panelMuteButton.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

RefPtr<MediaControlVolumeSliderContainerElement> sliderContainer = MediaControlVolumeSliderContainerElement::create(document);
m_volumeSliderContainer = sliderContainer.get();
panel->appendChild(sliderContainer.release(), exceptionCode);
panel->appendChild(sliderContainer.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolumeSliderElement::create(document);
m_volumeSlider = slider.get();
m_volumeSlider->setClearMutedOnUserInteraction(true);
m_volumeSliderContainer->appendChild(slider.release(), exceptionCode);
m_volumeSliderContainer->appendChild(slider.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

m_panel = panel.get();
enclosure->appendChild(panel.release(), exceptionCode);
enclosure->appendChild(panel.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

m_enclosure = enclosure.get();
appendChild(enclosure.release(), exceptionCode);
appendChild(enclosure.releaseNonNull(), exceptionCode);
if (exceptionCode)
return false;

Expand Down Expand Up @@ -252,7 +252,7 @@ void MediaControlsWKC::createTextTrackDisplay()
m_textDisplayContainer->setMediaController(m_mediaController);

// Insert it before the first controller element so it always displays behind the controls.
insertBefore(textDisplayContainer.release(), m_enclosure, ASSERT_NO_EXCEPTION);
insertBefore(textDisplayContainer.releaseNonNull(), m_enclosure, ASSERT_NO_EXCEPTION);
}
#endif

Expand Down
5 changes: 5 additions & 0 deletions WKC/WebCore/platform/WKC/PasteboardWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,9 @@ void Pasteboard::setDragImage(DragImageRef, const IntPoint& hotSpot)
}
#endif

void Pasteboard::writeTrustworthyWebURLsPboardType(const PasteboardURL&)
{
notImplemented();
}

}
2 changes: 1 addition & 1 deletion WKC/WebCore/platform/WKC/WidgetWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void Widget::hide()
setSelfVisible(false);
}

void Widget::paint(GraphicsContext*, const IntRect&)
void Widget::paint(GraphicsContext*, const IntRect&, SecurityOriginPaintPolicy)
{
}

Expand Down
31 changes: 13 additions & 18 deletions WKC/WebCore/platform/audio/WKC/AudioBusWKC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2016 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2012-2017 ACCESS CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -45,12 +45,7 @@ PassRefPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float samp
return bus;
}
}

error_end:
// not found. dummy data
RefPtr<AudioBus> bus = adoptRef(new AudioBus(2, 256, true));
bus->setSampleRate(sampleRate);
return bus;
return nullptr;
}

PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dataSize, bool mixToMono, float sampleRate)
Expand All @@ -70,14 +65,14 @@ PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dat
if (bps==16) dlen>>=1;
if (channels==2) dlen>>=1;
else if (channels==4) dlen>>=2;
RefPtr<AudioBus> orig = AudioBus::create(2, dlen, true);
RefPtr<AudioBus> orig = AudioBus::create(channels, dlen, true);

orig->setSampleRate(srate);

AudioChannel* lch = orig->channel(AudioBus::ChannelLeft);
AudioChannel* rch = orig->channel(AudioBus::ChannelRight);
AudioChannel* rch = (channels >= 2) ? orig->channel(AudioBus::ChannelRight) : nullptr;
float* dl = lch->mutableData();
float* dr = rch->mutableData();
float* dr = (rch) ? rch->mutableData() : nullptr;

int bl=0, bh=1;
if (endian==WKC_MEDIA_ENDIAN_BIGENDIAN) {
Expand All @@ -101,7 +96,9 @@ PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dat
else if (r>1.f) r=1.f;
}
dl[i] = l;
dr[i] = r;
if (dr) {
dr[i] = r;
}
}
} else {
for (int i=0; i<dlen;i++) {
Expand Down Expand Up @@ -129,18 +126,16 @@ PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dat
sp+=2;
}
dl[i] = l;
dr[i] = r;
if (dr) {
dr[i] = r;
}
}
}
buf.clear();
return AudioBus::createBySampleRateConverting(orig.get(), mixToMono, sampleRate);
}
}

error_end:
// failed to decode. dummy data.
RefPtr<AudioBus> bus = AudioBus::create(1, 256, true);
bus->setSampleRate(sampleRate);
return bus;
return nullptr;
}

} // namespace WebCore
Expand Down
4 changes: 4 additions & 0 deletions WKC/WebCore/platform/audio/WKC/AudioDestinationWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ AudioDestinationWKC::setFormat(size_t numberOfChannels, float sampleRate)
void
AudioDestinationWKC::start()
{
if (m_peer) {
return;
}

m_peer = wkcAudioOpenPeer(wkcAudioPreferredSampleRatePeer(), 16, 2, 0);

if (!m_peer) {
Expand Down
4 changes: 4 additions & 0 deletions WKC/WebCore/platform/graphics/WKC/ImageDecoderWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ ImageFrame::operator=(const ImageFrame& other)
setDuration(other.duration());
setDisposalMethod(other.disposalMethod());
setPremultiplyAlpha(other.premultiplyAlpha());
#if ENABLE(WKC_BLINK_AWEBP)
m_alphaBlendSource = other.alphaBlendSource();
m_requiredPreviousFrameIndex = other.requiredPreviousFrameIndex();
#endif
return *this;
}

Expand Down
6 changes: 6 additions & 0 deletions WKC/WebCore/platform/graphics/WKC/MediaPlayerPrivateWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,12 @@ MediaPlayerPrivate::setEndTime(float in_time)
(void)wkcMediaPlayerSetEndTimePeer(m_peer, in_time);
}

double
MediaPlayerPrivate::rate() const
{
return wkcMediaPlayerRatePeer(m_peer);
}

void
MediaPlayerPrivate::setRate(float rate)
{
Expand Down
3 changes: 2 additions & 1 deletion WKC/WebCore/platform/graphics/WKC/MediaPlayerPrivateWKC.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2016 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2011-2017 ACCESS CO., LTD. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
Expand Down Expand Up @@ -82,6 +82,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface, public ResourceH

virtual void setEndTime(float);

double rate() const;
virtual void setRate(float);
virtual void setPreservesPitch(bool);

Expand Down
Loading

0 comments on commit d50d974

Please sign in to comment.