Skip to content

Commit

Permalink
3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneWeird committed Jun 20, 2017
1 parent 171a742 commit fa6acac
Show file tree
Hide file tree
Showing 388 changed files with 17,648 additions and 1,384 deletions.
4 changes: 3 additions & 1 deletion WKC/WTF/wtf/WKC/ThreadingWKC.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007 Justin Haygood ([email protected])
* Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2010-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 @@ -159,6 +159,8 @@ removeThreadIdentifier(ThreadIdentifier id)
int waitForThreadCompletion(ThreadIdentifier threadID)
{
void* instance = getThreadInstance(threadID);
if (!instance)
return 0;
int ret = wkcThreadJoinPeer(instance, 0);
removeThreadIdentifier(threadID);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion WKC/WebCore/platform/WKC/GamepadProviderWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ GamepadProviderWKC::updateGamepadValue(unsigned int in_index, long long timestam
gamepad->updateValue(timestamp, vaxes, vbuttons);

for (auto& client : m_clients)
client->platformGamepadInputActivity();
client->platformGamepadInputActivity(true);
}

} // namespace WebCore
Expand Down
50 changes: 43 additions & 7 deletions WKC/WebCore/platform/WKC/RenderThemeWKC.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Kevin Ollivier <[email protected]>
* Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2010-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 @@ -1220,16 +1220,52 @@ Color RenderThemeWKC::platformInactiveSelectionForegroundColor() const

int RenderThemeWKC::popupInternalPaddingLeft(RenderStyle& style) const
{
return cPopupInternalPaddingLeft;
int width = 0;

switch (style.appearance()) {
case MenulistPart: // default
width += 1;
// fall through
case MenulistButtonPart:
width += cPopupInternalPaddingLeft;
break;
case ButtonPart:
width = 1;
break;
default:
break;
}

return width;
}

int RenderThemeWKC::popupInternalPaddingRight(RenderStyle& style) const
{
unsigned int w=0, h=0;
float scale = wkcStockImageGetImageScalePeer();
wkcStockImageGetSizePeer(WKC_IMAGE_MENU_LIST_BUTTON, &w, &h);
w *= scale;
return w + cPopupInternalPaddingRight;
int width = 0;

switch (style.appearance()) {
case MenulistPart: // default
width += 1;
// fall through
case MenulistButtonPart:
{
unsigned int w=0, h=0;
float scale = wkcStockImageGetImageScalePeer();
wkcStockImageGetSizePeer(WKC_IMAGE_MENU_LIST_BUTTON, &w, &h);
w *= scale;

width += cPopupInternalPaddingRight;
width += w;
}
break;
case ButtonPart:
width = 1;
break;
default:
break;
}

return width;
}

int RenderThemeWKC::popupInternalPaddingTop(RenderStyle& style) const
Expand Down
99 changes: 33 additions & 66 deletions WKC/WebCore/platform/audio/WKC/AudioDestinationWKC.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 @@ -39,7 +39,6 @@
namespace WebCore {

static const unsigned int c_busFrameSize = 128; // 3ms window
static const int c_drainBuffers = 3; // 9ms flush interval

class AudioDestinationWKC : public AudioDestination, AudioSourceProviderClient
{
Expand Down Expand Up @@ -75,10 +74,6 @@ class AudioDestinationWKC : public AudioDestination, AudioSourceProviderClient

ThreadIdentifier m_thread;
bool m_quit;

float m_drainBuffer0[c_busFrameSize * c_drainBuffers];
float m_drainBuffer1[c_busFrameSize * c_drainBuffers];
int m_drainCount = 0;
};

AudioDestinationWKC::AudioDestinationWKC(AudioIOCallback& cb, float sampleRate)
Expand Down Expand Up @@ -118,9 +113,6 @@ AudioDestinationWKC::create(AudioIOCallback& cb, float sampleRate)
bool
AudioDestinationWKC::construct()
{
m_peer = wkcAudioOpenPeer(wkcAudioPreferredSampleRatePeer(), 16, 2, 0);

//Prevents crashing, but audio won't play if m_peer==nullptr
return true;
}

Expand All @@ -134,8 +126,19 @@ AudioDestinationWKC::setFormat(size_t numberOfChannels, float sampleRate)
void
AudioDestinationWKC::start()
{
m_peer = wkcAudioOpenPeer(wkcAudioPreferredSampleRatePeer(), 16, 2, 0);

if (!m_peer) {
return;
}

m_quit = false;
m_thread = createThread(threadProc, this, "WKC: AudioDestination");

if (!m_thread) {
wkcAudioClosePeer(m_peer);
m_peer = 0;
}
}

void
Expand All @@ -148,6 +151,11 @@ AudioDestinationWKC::stop()
waitForThreadCompletion(m_thread);
m_thread = 0;
}

if (m_peer) {
wkcAudioClosePeer(m_peer);
m_peer = 0;
}
}

bool
Expand All @@ -164,76 +172,35 @@ AudioDestinationWKC::sampleRate() const

void AudioDestinationWKC::drain()
{
if (m_quit)
if (m_quit || !m_peer)
return;

float* sampleMatrix[2] = { m_drainBuffer0, m_drainBuffer1 };
const size_t sampleCount = c_busFrameSize * c_drainBuffers;
const size_t len = sampleCount * 2 * sizeof(int16_t);
int16_t* pcm = static_cast<int16_t*>(WTF::fastMalloc(len));
float** dataArray = static_cast<float**>(WTF::fastMalloc(m_channels * sizeof(float*)));
float* maxAbsValueArray = static_cast<float*>(WTF::fastMalloc(m_channels * sizeof(float)));

unsigned int channels = 0;
bool shouldDrainNextData = true;

while (!m_quit) {
wkcThreadCheckAlivePeer();
wkc_usleep(1000);

// Update on a 3ms window
m_audioIOCallback.render(0, m_bus.get(), c_busFrameSize);

if (m_peer) {
int channels = 1;
if (shouldDrainNextData) {
// Update on a 3ms window
m_audioIOCallback.render(0, m_bus.get(), c_busFrameSize);

// Copy the samples into the drainBuffer
float * sampleData0 = m_bus->channel(0)->mutableData();
float * sampleData1 = sampleData0;
channels = m_bus->numberOfChannels();

if (channels > 1) {
sampleData1 = m_bus->channel(1)->mutableData();
}

for (int i = 0; i < m_bus->channel(0)->length(); i++) {
m_drainBuffer0[(m_drainCount*c_busFrameSize) + i] = sampleData0[i];
m_drainBuffer1[(m_drainCount*c_busFrameSize) + i] = sampleData1[i];
}

m_drainCount++;

// Flush on a 3ms * c_drainBuffers interval to compensate for HW flushing perf
if (m_drainCount >= c_drainBuffers) {
// Convert float to pcm16
int16_t scaler = std::numeric_limits<int16_t>::max();
float sample = 0.0f;
for (auto i = 0; i < sampleCount; ++i) {
sample = sampleMatrix[0][i];

#ifdef ENABLE_SOFTWARE_CLAMPING
if (sample > 1.0f) {
sample = 1.0f;
} else if (sample < -1.0f) {
sample = -1.0f;
}
#endif
pcm[i * 2] = static_cast<int16_t>(scaler * sample);

sample = sampleMatrix[1][i];
#ifdef ENABLE_SOFTWARE_CLAMPING
if (sample > 1.0f) {
sample = 1.0f;
} else if (sample < -1.0f) {
sample = -1.0f;
}
#endif
pcm[i * 2 + 1] = static_cast<int16_t>(scaler * sample);
}

wkcAudioWritePeer(m_peer, pcm, len);
m_drainCount = 0;
for (unsigned int i = 0; i < channels; ++i) {
dataArray[i] = m_bus->channel(i)->mutableData();
maxAbsValueArray[i] = m_bus->channel(i)->maxAbsValue();
}
}

wkc_usleep(1000);
shouldDrainNextData = wkcAudioWriteRawPeer(m_peer, dataArray, channels, c_busFrameSize, maxAbsValueArray);
}

WTF::fastFree(pcm);
WTF::fastFree(maxAbsValueArray);
WTF::fastFree(dataArray);
}

std::unique_ptr<AudioDestination> AudioDestination::create(AudioIOCallback& cb, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
Expand Down
21 changes: 16 additions & 5 deletions WKC/WebCore/platform/graphics/WKC/GraphicsContext3DWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2011 Google Inc. All rights reserved.
* Copyright (C) 2012 ChangSeok Oh <[email protected]>
* Copyright (C) 2012 Research In Motion Limited. All rights reserved.
* Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2011-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 @@ -252,15 +252,19 @@ GraphicsContext3DPrivate::create(GraphicsContext3D* parent, GraphicsContext3D::A
attrs.preserveDrawingBuffer,
attrs.noExtensions,
attrs.shareResources,
attrs.preferDiscreteGPU,
attrs.preferLowPowerToHighPerformance,
attrs.forceSoftwareRenderer,
attrs.failIfMajorPerformanceCaveat,
attrs.useGLES3,
attrs.devicePixelRatio,
};

GraphicsContext3DPrivate* v = new GraphicsContext3DPrivate();

std::unique_ptr<GraphicsContext3DPrivate> self;
self.reset(v);

self->m_peer = wkcGLCreateContextPeer(&ga, (void *)hostwindow);
self->m_peer = wkcGLCreateContextPeer(&ga, (void *)hostwindow, self->m_layer);
if (!self->m_peer) {
return nullptr;
}
Expand Down Expand Up @@ -2373,14 +2377,21 @@ GraphicsContext3D::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)

#include "GraphicsContext3D.h"

#include "Extensions3D.h"
#if USE(OPENGL_ES_2)
#include "Extensions3DOpenGLES.h"
#else
#include "Extensions3DOpenGL.h"
#endif

namespace WebCore {

class GraphicsContext3DPrivate
{
public:
static PassOwnPtr<GraphicsContext3DPrivate> create(GraphicsContext3D::Attributes& attrs, HostWindow* hostwindow, bool in_direct)
static std::unique_ptr<GraphicsContext3DPrivate> create(GraphicsContext3D::Attributes& attrs, HostWindow* hostwindow, bool in_direct)
{
return 0;
return nullptr;
}
~GraphicsContext3DPrivate() {}

Expand Down
6 changes: 5 additions & 1 deletion WKC/WebCore/platform/graphics/WKC/ImageDecoderWKC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 ACCESS CO., LTD. All rights reserved.
* Copyright (c) 2010-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 @@ -36,6 +36,10 @@ ImageFrame::ImageFrame()
, m_duration(0)
, m_disposalMethod(DisposeNotSpecified)
, m_premultiplyAlpha(true)
#if ENABLE(WKC_BLINK_AWEBP)
, m_alphaBlendSource(BlendAtopPreviousFrame)
, m_requiredPreviousFrameIndex(-1)
#endif
{
m_image = ImageWKC::create();
}
Expand Down
7 changes: 7 additions & 0 deletions WKC/WebCore/platform/graphics/WKC/SourceBufferPrivateWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ SourceBufferPrivateWKC::abort()
(void)wkcMediaPlayerAbortSBPeer(m_peer, m_sourcebuffer);
}

void
SourceBufferPrivateWKC::resetParserState()
{
// TODO
abort();
}

bool
SourceBufferPrivateWKC::setTimestampOffset(double timestamp_offset)
{
Expand Down
1 change: 1 addition & 0 deletions WKC/WebCore/platform/graphics/WKC/SourceBufferPrivateWKC.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SourceBufferPrivateWKC : public SourceBufferPrivate {
virtual void setClient(SourceBufferPrivateClient*);
virtual void append(const unsigned char* data, unsigned length);
virtual void abort();
virtual void resetParserState();
virtual bool setTimestampOffset(double);
#if PLATFORM(WKC)
virtual bool removedFromMediaSource();
Expand Down
11 changes: 11 additions & 0 deletions WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,14 @@ bool ResourceHandleManager::finalizingResourceHandle(ResourceHandle* job, Resour
}
}
if (httpCode == 401 || 407 == httpCode) {
if (d->m_msgDataResult != CURLE_OK){
finishLoadingResourceHandle(job, d);
if (d->client()){
ResourceError err(String(), d->m_msgDataResult, String(d->m_url), String(curl_easy_strerror((CURLcode)d->m_msgDataResult)), job);
d->client()->didFail(job, err);
}
return true;
}
didReceiveAuthenticationChallenge(job, d->m_currentWebChallenge);
if (d->m_cancelled || d->m_didAuthChallenge) {
finishLoadingResourceHandle(job, d);
Expand Down Expand Up @@ -3102,6 +3110,9 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job)
// if file/data scheme loading, do not set proxy/authenticate
if (d->m_fileLoading || d->m_dataLoading) {
d->m_response.setResourceHandle(job);
if (d->m_fileLoading) {
handleLocalReceiveResponse(d->m_handle, job, d);
}
nxLog_out("");
return;
}
Expand Down
5 changes: 4 additions & 1 deletion WKC/WebCore/platform/network/WKC/SocketStreamHandle.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (c) 2012, 2015 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 are
Expand Down Expand Up @@ -91,6 +91,9 @@ namespace WebCore {
private:
bool m_constructed;

bool m_needClosing;
bool m_clientCallingFromTimer;

int m_socketState;

int m_socket;
Expand Down
Loading

0 comments on commit fa6acac

Please sign in to comment.