Skip to content

Commit

Permalink
Switch to standard integer types in blimp/.
Browse files Browse the repository at this point in the history
BUG=138542
TBR=wez@chromium.org

Review URL: https://codereview.chromium.org/1538253002

Cr-Commit-Position: refs/heads/master@{#366303}
  • Loading branch information
avi authored and Commit bot committed Dec 20, 2015
1 parent fe69ec3 commit 0f2f93d
Show file tree
Hide file tree
Showing 24 changed files with 50 additions and 26 deletions.
2 changes: 2 additions & 0 deletions blimp/client/compositor/blimp_context_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_
#define BLIMP_CLIENT_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_

#include <stdint.h>

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
Expand Down
2 changes: 2 additions & 0 deletions blimp/client/session/render_widget_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_CLIENT_SESSION_RENDER_WIDGET_FEATURE_H_
#define BLIMP_CLIENT_SESSION_RENDER_WIDGET_FEATURE_H_

#include <stdint.h>

#include "base/containers/small_map.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
Expand Down
2 changes: 1 addition & 1 deletion blimp/common/create_blimp_message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ scoped_ptr<BlimpMessage> CreateStartConnectionMessage(
return output;
}

scoped_ptr<BlimpMessage> CreateCheckpointAckMessage(int64 checkpoint_id) {
scoped_ptr<BlimpMessage> CreateCheckpointAckMessage(int64_t checkpoint_id) {
scoped_ptr<BlimpMessage> output(new BlimpMessage);
output->set_type(BlimpMessage::PROTOCOL_CONTROL);

Expand Down
4 changes: 3 additions & 1 deletion blimp/common/create_blimp_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_COMMON_CREATE_BLIMP_MESSAGE_H_
#define BLIMP_COMMON_CREATE_BLIMP_MESSAGE_H_

#include <stdint.h>

#include <string>

#include "base/memory/scoped_ptr.h"
Expand Down Expand Up @@ -59,7 +61,7 @@ BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateStartConnectionMessage(
int protocol_version);

BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateCheckpointAckMessage(
int64 checkpoint_id);
int64_t checkpoint_id);

} // namespace blimp

Expand Down
2 changes: 1 addition & 1 deletion blimp/engine/browser/blimp_engine_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const int kDummyTabId = 0;
const float kDefaultScaleFactor = 1.f;
const int kDefaultDisplayWidth = 800;
const int kDefaultDisplayHeight = 600;
const uint16 kDefaultPortNumber = 25467;
const uint16_t kDefaultPortNumber = 25467;

base::LazyInstance<blimp::NullBlimpMessageProcessor> g_blimp_message_processor =
LAZY_INSTANCE_INITIALIZER;
Expand Down
2 changes: 2 additions & 0 deletions blimp/engine/browser/blimp_engine_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_
#define BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_

#include <stdint.h>

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "blimp/engine/browser/engine_render_widget_message_processor.h"
Expand Down
1 change: 1 addition & 0 deletions blimp/engine/browser/blimp_url_request_context_getter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define BLIMP_ENGINE_BROWSER_BLIMP_URL_REQUEST_CONTEXT_GETTER_H_

#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/content_browser_client.h"
#include "net/url_request/url_request_context_getter.h"
Expand Down
2 changes: 2 additions & 0 deletions blimp/engine/browser/engine_render_widget_message_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_ENGINE_BROWSER_ENGINE_RENDER_WIDGET_MESSAGE_PROCESSOR_H_
#define BLIMP_ENGINE_BROWSER_ENGINE_RENDER_WIDGET_MESSAGE_PROCESSOR_H_

#include <stdint.h>

#include <vector>

#include "base/containers/small_map.h"
Expand Down
2 changes: 1 addition & 1 deletion blimp/engine/ui/blimp_screen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace engine {

namespace {

const int64 kDisplayId = 1;
const int64_t kDisplayId = 1;
const int kNumDisplays = 1;

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions blimp/engine/ui/blimp_ui_context_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ bool BlimpUiContextFactory::DoesCreateTestContexts() {
return false;
}

uint32 BlimpUiContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
gfx::BufferUsage usage) {
uint32_t BlimpUiContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
gfx::BufferUsage usage) {
// No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
return GL_TEXTURE_2D;
}
Expand Down
6 changes: 4 additions & 2 deletions blimp/engine/ui/blimp_ui_context_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_ENGINE_UI_BLIMP_UI_CONTEXT_FACTORY_H_
#define BLIMP_ENGINE_UI_BLIMP_UI_CONTEXT_FACTORY_H_

#include <stdint.h>

#include "base/macros.h"
#include "blimp/common/compositor/blimp_task_graph_runner.h"
#include "ui/compositor/compositor.h"
Expand All @@ -27,8 +29,8 @@ class BlimpUiContextFactory : public ui::ContextFactory {
scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override;
void RemoveCompositor(ui::Compositor* compositor) override;
bool DoesCreateTestContexts() override;
uint32 GetImageTextureTarget(gfx::BufferFormat format,
gfx::BufferUsage usage) override;
uint32_t GetImageTextureTarget(gfx::BufferFormat format,
gfx::BufferUsage usage) override;
cc::SharedBitmapManager* GetSharedBitmapManager() override;
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
cc::TaskGraphRunner* GetTaskGraphRunner() override;
Expand Down
4 changes: 2 additions & 2 deletions blimp/net/blimp_message_checkpoint_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BLIMP_NET_BLIMP_MESSAGE_CHECKPOINT_OBSERVER_H_
#define BLIMP_NET_BLIMP_MESSAGE_CHECKPOINT_OBSERVER_H_

#include "base/basictypes.h"
#include <stdint.h>

namespace blimp {

Expand All @@ -16,7 +16,7 @@ class BlimpMessageCheckpointObserver {

// Invoked when the remote end has positively acknowledged the receipt of all
// messages with ID <= |message_id|.
virtual void OnMessageCheckpoint(int64 message_id) = 0;
virtual void OnMessageCheckpoint(int64_t message_id) = 0;
};

} // namespace blimp
Expand Down
4 changes: 3 additions & 1 deletion blimp/net/blimp_message_checkpointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_NET_BLIMP_MESSAGE_CHECKPOINTER_H_
#define BLIMP_NET_BLIMP_MESSAGE_CHECKPOINTER_H_

#include <stdint.h>

#include "base/macros.h"
#include "base/timer/timer.h"
#include "blimp/net/blimp_message_processor.h"
Expand Down Expand Up @@ -42,7 +44,7 @@ class BLIMP_NET_EXPORT BlimpMessageCheckpointer : public BlimpMessageProcessor {
BlimpMessageCheckpointObserver* checkpoint_observer_;

// Holds the Id of the message that most recently completed processing.
int64 checkpoint_id_ = 0;
int64_t checkpoint_id_ = 0;

// Used to batch multiple processed messages into a single ACK.
base::OneShotTimer defer_timer_;
Expand Down
8 changes: 4 additions & 4 deletions blimp/net/blimp_message_checkpointer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class MockCheckpointObserver : public BlimpMessageCheckpointObserver {
MockCheckpointObserver() {}
~MockCheckpointObserver() override {}

MOCK_METHOD1(OnMessageCheckpoint, void(int64));
MOCK_METHOD1(OnMessageCheckpoint, void(int64_t));
};

} // namespace

static scoped_ptr<BlimpMessage> CreateExpectedAckMessage(int64 id) {
static scoped_ptr<BlimpMessage> CreateExpectedAckMessage(int64_t id) {
scoped_ptr<BlimpMessage> message = make_scoped_ptr(new BlimpMessage);
message->set_type(BlimpMessage::PROTOCOL_CONTROL);
ProtocolControlMessage* protocol_control =
Expand All @@ -52,7 +52,7 @@ class BlimpMessageCheckpointerTest : public testing::Test {

~BlimpMessageCheckpointerTest() override {}

int64 SimulateIncomingMessage() {
int64_t SimulateIncomingMessage() {
scoped_ptr<BlimpMessage> message(new BlimpMessage);
message->set_message_id(++message_id_);
message->set_type(BlimpMessage::INPUT);
Expand All @@ -75,7 +75,7 @@ class BlimpMessageCheckpointerTest : public testing::Test {
scoped_refptr<base::TestMockTimeTaskRunner> runner_;
base::ThreadTaskRunnerHandle runner_handle_;

int64 message_id_ = 0;
int64_t message_id_ = 0;

testing::StrictMock<MockBlimpMessageProcessor> incoming_processor_;
testing::StrictMock<MockBlimpMessageProcessor> outgoing_processor_;
Expand Down
2 changes: 1 addition & 1 deletion blimp/net/blimp_message_output_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void BlimpMessageOutputBuffer::ProcessMessage(

// Flushes acknowledged messages from the buffer and invokes their
// |callbacks|, if any.
void BlimpMessageOutputBuffer::OnMessageCheckpoint(int64 message_id) {
void BlimpMessageOutputBuffer::OnMessageCheckpoint(int64_t message_id) {
VLOG(2) << "OnMessageCheckpoint (message_id=" << message_id << ")";
if (ack_buffer_.empty()) {
LOG(WARNING) << "Checkpoint called while buffer is empty.";
Expand Down
6 changes: 4 additions & 2 deletions blimp/net/blimp_message_output_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_NET_BLIMP_MESSAGE_OUTPUT_BUFFER_H_
#define BLIMP_NET_BLIMP_MESSAGE_OUTPUT_BUFFER_H_

#include <stdint.h>

#include <list>
#include <queue>
#include <utility>
Expand Down Expand Up @@ -46,7 +48,7 @@ class BLIMP_NET_EXPORT BlimpMessageOutputBuffer
const net::CompletionCallback& callback) override;

// MessageCheckpointObserver implementation.
void OnMessageCheckpoint(int64 message_id) override;
void OnMessageCheckpoint(int64_t message_id) override;

int GetBufferByteSizeForTest() const;
int GetUnacknowledgedMessageCountForTest() const;
Expand Down Expand Up @@ -81,7 +83,7 @@ class BLIMP_NET_EXPORT BlimpMessageOutputBuffer
int current_buffer_size_bytes_ = 0;

// The ID used by the last outgoing message.
int64 prev_message_id_ = 0;
int64_t prev_message_id_ = 0;

// List of unsent messages.
MessageBuffer write_buffer_;
Expand Down
2 changes: 1 addition & 1 deletion blimp/net/blimp_message_output_buffer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BlimpMessageOutputBufferTest : public testing::Test {
.RetiresOnSaturation();
}

BlimpMessage WithMessageId(const BlimpMessage& message, int64 message_id) {
BlimpMessage WithMessageId(const BlimpMessage& message, int64_t message_id) {
BlimpMessage output = message;
output.set_message_id(message_id);
return output;
Expand Down
2 changes: 2 additions & 0 deletions blimp/net/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_NET_COMMON_H_
#define BLIMP_NET_COMMON_H_

#include <stddef.h>

#include <string>

#include "blimp/net/blimp_net_export.h"
Expand Down
2 changes: 1 addition & 1 deletion blimp/net/stream_packet_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int StreamPacketReader::DoReadHeader(int result) {

// Finished reading the header. Parse the size and prepare for payload read.
payload_size_ = base::NetToHost32(
*reinterpret_cast<uint32*>(header_buffer_->StartOfBuffer()));
*reinterpret_cast<uint32_t*>(header_buffer_->StartOfBuffer()));
if (payload_size_ > static_cast<size_t>(payload_buffer_->capacity()) ||
payload_size_ == 0) {
DLOG(ERROR) << "Illegal payload size: " << payload_size_;
Expand Down
2 changes: 2 additions & 0 deletions blimp/net/stream_packet_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BLIMP_NET_STREAM_PACKET_READER_H_
#define BLIMP_NET_STREAM_PACKET_READER_H_

#include <stddef.h>

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
Expand Down
2 changes: 1 addition & 1 deletion blimp/net/stream_packet_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void StreamPacketWriter::WritePacket(scoped_refptr<net::DrainableIOBuffer> data,

write_state_ = WriteState::HEADER;
header_buffer_->SetOffset(0);
*reinterpret_cast<uint32*>(header_buffer_->data()) =
*reinterpret_cast<uint32_t*>(header_buffer_->data()) =
base::HostToNet32(data->BytesRemaining());
payload_buffer_ = data;

Expand Down
2 changes: 1 addition & 1 deletion blimp/net/tcp_transport_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TCPTransportTest : public testing::Test {
}

void ParseAddress(const std::string& ip_str,
uint16 port,
uint16_t port,
net::IPEndPoint* address) {
net::IPAddressNumber ip_number;
bool rv = net::ParseIPLiteralToNumber(ip_str, &ip_number);
Expand Down
2 changes: 1 addition & 1 deletion blimp/net/test_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void MockBlimpMessageProcessor::ProcessMessage(

std::string EncodeHeader(size_t size) {
scoped_ptr<char[]> serialized(new char[kPacketHeaderSizeBytes]);
uint32 net_size = base::HostToNet32(size);
uint32_t net_size = base::HostToNet32(size);
memcpy(serialized.get(), &net_size, sizeof(net_size));
return std::string(serialized.get(), kPacketHeaderSizeBytes);
}
Expand Down
9 changes: 6 additions & 3 deletions blimp/net/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#ifndef BLIMP_NET_TEST_COMMON_H_
#define BLIMP_NET_TEST_COMMON_H_

#include <stddef.h>
#include <stdint.h>

#include <string>

#include "base/memory/scoped_ptr.h"
Expand Down Expand Up @@ -101,8 +104,8 @@ class MockStreamSocket : public net::StreamSocket {

MOCK_METHOD3(Read, int(net::IOBuffer*, int, const net::CompletionCallback&));
MOCK_METHOD3(Write, int(net::IOBuffer*, int, const net::CompletionCallback&));
MOCK_METHOD1(SetReceiveBufferSize, int(int32));
MOCK_METHOD1(SetSendBufferSize, int(int32));
MOCK_METHOD1(SetReceiveBufferSize, int(int32_t));
MOCK_METHOD1(SetSendBufferSize, int(int32_t));
MOCK_METHOD1(Connect, int(const net::CompletionCallback&));
MOCK_METHOD0(Disconnect, void());
MOCK_CONST_METHOD0(IsConnected, bool());
Expand All @@ -114,7 +117,7 @@ class MockStreamSocket : public net::StreamSocket {
MOCK_METHOD0(SetOmniboxSpeculation, void());
MOCK_CONST_METHOD0(WasEverUsed, bool());
MOCK_CONST_METHOD0(UsingTCPFastOpen, bool());
MOCK_CONST_METHOD0(NumBytesRead, int64());
MOCK_CONST_METHOD0(NumBytesRead, int64_t());
MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta());
MOCK_CONST_METHOD0(WasNpnNegotiated, bool());
MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto());
Expand Down

0 comments on commit 0f2f93d

Please sign in to comment.