Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Cobalt 24 various commits #3965

Draft
wants to merge 5 commits into
base: 24.lts.1+
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "base/logging.h"

#include <limits.h>
#include <sys/resource.h>

#include "base/macros.h"
#include "base/trace_event/trace_event.h"
Expand Down Expand Up @@ -125,6 +126,30 @@ typedef pthread_mutex_t* MutexHandle;

namespace logging {

namespace {
std::string print_rusage(int who,
const char* prefix = "",
const char* postfix = "") {
struct rusage usage;
if (getrusage(who, &usage) != -1) {
return starboard::FormatString(
"%s(CPU:u%ld.%03ld+s%ld=%ld.%03ld,FLT:%ld+%ld,CTX:%ld+%ld)%s", prefix,
usage.ru_utime.tv_sec, usage.ru_utime.tv_usec / 1000,
usage.ru_stime.tv_sec, usage.ru_stime.tv_usec / 1000,
((usage.ru_utime.tv_sec + usage.ru_stime.tv_sec) * 1000000 +
(usage.ru_utime.tv_usec + usage.ru_stime.tv_usec)) / 1000,
usage.ru_minflt, usage.ru_majflt, usage.ru_nvcsw, usage.ru_nivcsw,
postfix);
}
return std::string(strerror(errno));
}

std::string print_stats() {
return print_rusage(RUSAGE_THREAD, "(", "/") +
print_rusage(RUSAGE_SELF, "", ")");
}
} // namespace

namespace {

VlogInfo* g_vlog_info = nullptr;
Expand Down Expand Up @@ -1040,7 +1065,8 @@ void LogMessage::Init(const char* file, int line) {
stream_ << CurrentProcessId() << ':';
#endif
if (g_log_thread_id)
stream_ << base::PlatformThread::GetName() << '/' << base::PlatformThread::CurrentId() << ":";
stream_ << base::PlatformThread::GetName() << '/'
<< base::PlatformThread::CurrentId() << "/" << print_stats() << ":";
if (g_log_timestamp) {
#if defined(STARBOARD)
EzTimeValue time_value;
Expand Down
6 changes: 4 additions & 2 deletions cobalt/web/csp_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ bool CspDelegateSecure::CanLoad(ResourceType type, const GURL& url,
if (csp_header_policy_ == csp::kCSPRequired || should_allow) {
return should_allow;
} else {
LOG(WARNING) << "Page must include Content-Security-Policy header, it "
"will fail to load in production builds of Cobalt!";
if (type == kLocation) {
LOG(WARNING) << "Page must include Content-Security-Policy header, it "
"will fail to load in production builds of Cobalt!";
}
}
}

Expand Down
1 change: 1 addition & 0 deletions net/http/http_stream_factory_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class HttpStreamFactory::Job {

void SetPriority(RequestPriority priority);

const GURL& origin_url() const { return origin_url_; }
RequestPriority priority() const { return priority_; }
bool was_alpn_negotiated() const;
NextProto negotiated_protocol() const;
Expand Down
11 changes: 11 additions & 0 deletions net/http/http_stream_factory_job_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ void HttpStreamFactory::JobController::OnStreamReady(
std::unique_ptr<HttpStream> stream = job->ReleaseStream();
DCHECK(stream);

{
const char* jobtypename[] = {"main", "alternative", "dns_alpn_h3", "preconnect",
"preconnect_dns_alpn_h3"};
LOG(INFO) << __FUNCTION__ << " negotiated_protocol = "
<< NextProtoToString(job->negotiated_protocol())
<< " was_alpn_negotiated=" << job->was_alpn_negotiated()
<< " using_spdy=" << job->using_spdy()
<< " using_quic=" << job->using_quic()
<< " job_type=" << jobtypename[(int)job->job_type()] << " "
<< job->origin_url().spec();
}
MarkRequestComplete(job->was_alpn_negotiated(), job->negotiated_protocol(),
job->using_spdy());

Expand Down
4 changes: 4 additions & 0 deletions starboard/android/apk/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ android {
}
}
packagingOptions {
doNotStrip "*/arm64-v8a/*.so"
doNotStrip "*/armeabi-v7a/*.so"
doNotStrip "*/x86/*.so"
doNotStrip "*/x86_64/*.so"
jniLibs {
// extractNativeLibs, which we set, based on evergreenCompatible, in the manifest file,
// is deprecated. Gradle asks that useLegacyPackaging be set if extractNativeLibs is
Expand Down
2 changes: 2 additions & 0 deletions starboard/android/apk/app/src/app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
android:exported="false"
android:foregroundServiceType="mediaPlayback"/>

<!-- https://developer.android.com/guide/topics/manifest/profileable-element -->
<profileable android:shell="true" android:enabled="true" />.
</application>

<queries>
Expand Down
3 changes: 2 additions & 1 deletion starboard/shared/posix/socket_bind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "starboard/common/socket.h"

#include <errno.h>
#include <string.h>
#include <sys/socket.h>

#include "starboard/common/log.h"
Expand Down Expand Up @@ -63,7 +64,7 @@ SbSocketError SbSocketBind(SbSocket socket,
int result = HANDLE_EINTR(
bind(socket->socket_fd, sock_addr.sockaddr(), sock_addr.length));
if (result != 0) {
SB_LOG(ERROR) << __FUNCTION__ << ": Bind failed. errno=" << errno;
SB_LOG(ERROR) << __FUNCTION__ << ": Bind failed. errno=" << strerror(errno);
return (socket->error = sbposix::TranslateSocketErrno(errno));
}

Expand Down
3 changes: 2 additions & 1 deletion starboard/shared/posix/socket_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "starboard/common/socket.h"

#include <errno.h>
#include <string.h>
#include <sys/socket.h>

#include "starboard/common/log.h"
Expand Down Expand Up @@ -49,7 +50,7 @@ SbSocketError SbSocketConnect(SbSocket socket, const SbSocketAddress* address) {
}

if (result != 0) {
SB_LOG(ERROR) << __FUNCTION__ << ": connect failed: " << errno;
SB_LOG(ERROR) << __FUNCTION__ << ": connect failed: " << strerror(errno);
return (socket->error = kSbSocketErrorFailed);
}

Expand Down
Loading