Skip to content

Commit

Permalink
Convert //content/renderer from scoped_ptr to std::unique_ptr
Browse files Browse the repository at this point in the history
BUG=554298
R=avi@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#386267}
  • Loading branch information
zetafunction authored and Commit bot committed Apr 9, 2016
1 parent af402ee commit cedca56
Show file tree
Hide file tree
Showing 199 changed files with 1,067 additions and 945 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TEST_F(RendererAccessibilityTest, SendFullAccessibilityTreeOnReload) {
LoadHTML(html.c_str());

// Creating a RendererAccessibility should sent the tree to the browser.
scoped_ptr<TestRendererAccessibility> accessibility(
std::unique_ptr<TestRendererAccessibility> accessibility(
new TestRendererAccessibility(frame()));
accessibility->SendPendingAccessibilityEvents();
EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser());
Expand Down Expand Up @@ -181,7 +181,7 @@ TEST_F(RendererAccessibilityTest, HideAccessibilityObject) {
"</body>";
LoadHTML(html.c_str());

scoped_ptr<TestRendererAccessibility> accessibility(
std::unique_ptr<TestRendererAccessibility> accessibility(
new TestRendererAccessibility(frame()));
accessibility->SendPendingAccessibilityEvents();
EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser());
Expand Down Expand Up @@ -233,7 +233,7 @@ TEST_F(RendererAccessibilityTest, ShowAccessibilityObject) {
"</body>";
LoadHTML(html.c_str());

scoped_ptr<TestRendererAccessibility> accessibility(
std::unique_ptr<TestRendererAccessibility> accessibility(
new TestRendererAccessibility(frame()));
accessibility->SendPendingAccessibilityEvents();
EXPECT_EQ(3, CountAccessibilityNodesSentToBrowser());
Expand Down Expand Up @@ -277,7 +277,7 @@ TEST_F(RendererAccessibilityTest, DetachAccessibilityObject) {
"</body>";
LoadHTML(html.c_str());

scoped_ptr<TestRendererAccessibility> accessibility(
std::unique_ptr<TestRendererAccessibility> accessibility(
new TestRendererAccessibility(frame()));
accessibility->SendPendingAccessibilityEvents();
EXPECT_EQ(7, CountAccessibilityNodesSentToBrowser());
Expand Down
10 changes: 4 additions & 6 deletions content/renderer/android/email_detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

#include "content/renderer/android/email_detector.h"

#include <memory>

#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/renderer/android_content_detection_prefixes.h"
#include "net/base/escape.h"
Expand Down Expand Up @@ -52,11 +53,8 @@ bool EmailDetector::FindContent(const base::string16::const_iterator& begin,
icu::UnicodeString pattern(kEmailRegex);
icu::UnicodeString input(utf16_input.data(), utf16_input.length());
UErrorCode status = U_ZERO_ERROR;
scoped_ptr<icu::RegexMatcher> matcher(
new icu::RegexMatcher(pattern,
input,
UREGEX_CASE_INSENSITIVE,
status));
std::unique_ptr<icu::RegexMatcher> matcher(
new icu::RegexMatcher(pattern, input, UREGEX_CASE_INSENSITIVE, status));
if (matcher->find()) {
*start_pos = matcher->start(status);
DCHECK(U_SUCCESS(status));
Expand Down
7 changes: 4 additions & 3 deletions content/renderer/android/synchronous_compositor_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_
#define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_

#include <memory>

#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/config/gpu_info.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"

Expand Down Expand Up @@ -48,7 +49,7 @@ class SynchronousCompositorFactory {

virtual scoped_refptr<base::SingleThreadTaskRunner>
GetCompositorTaskRunner() = 0;
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
virtual std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
int routing_id,
uint32_t output_surface_id,
const scoped_refptr<FrameSwapMessageQueue>& frame_swap_message_queue,
Expand All @@ -60,7 +61,7 @@ class SynchronousCompositorFactory {
virtual SynchronousInputHandlerProxyClient*
GetSynchronousInputHandlerProxyClient() = 0;

virtual scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
virtual std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
int routing_id) = 0;

protected:
Expand Down
7 changes: 4 additions & 3 deletions content/renderer/android/synchronous_compositor_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ void SynchronousCompositorFilter::CheckIsReady(int routing_id) {
Entry& entry = entry_map_[routing_id];
if (filter_ready_ && entry.IsReady()) {
DCHECK(!sync_compositor_map_.contains(routing_id));
scoped_ptr<SynchronousCompositorProxy> proxy(new SynchronousCompositorProxy(
routing_id, this, entry.begin_frame_source,
entry.synchronous_input_handler_proxy, &input_handler_));
std::unique_ptr<SynchronousCompositorProxy> proxy(
new SynchronousCompositorProxy(
routing_id, this, entry.begin_frame_source,
entry.synchronous_input_handler_proxy, &input_handler_));
if (entry.output_surface)
proxy->SetOutputSurface(entry.output_surface);
sync_compositor_map_.add(routing_id, std::move(proxy));
Expand Down
5 changes: 3 additions & 2 deletions content/renderer/android/synchronous_compositor_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

#include <stdint.h>

#include <memory>

#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "content/renderer/android/synchronous_compositor_registry.h"
#include "content/renderer/input/input_handler_manager_client.h"
Expand Down Expand Up @@ -100,7 +101,7 @@ class SynchronousCompositorFilter
// Compositor thread-only fields.
using SyncCompositorMap =
base::ScopedPtrHashMap<int /* routing_id */,
scoped_ptr<SynchronousCompositorProxy>>;
std::unique_ptr<SynchronousCompositorProxy>>;
SyncCompositorMap sync_compositor_map_;
Handler input_handler_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
: cc::OutputSurface(
context_provider,
worker_context_provider,
scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
std::unique_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
routing_id_(routing_id),
output_surface_id_(output_surface_id),
registry_(registry),
Expand Down Expand Up @@ -259,9 +259,9 @@ void SynchronousCompositorOutputSurface::SetTreeActivationCallback(
}

void SynchronousCompositorOutputSurface::GetMessagesToDeliver(
std::vector<scoped_ptr<IPC::Message>>* messages) {
std::vector<std::unique_ptr<IPC::Message>>* messages) {
DCHECK(CalledOnValidThread());
scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope =
std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope =
frame_swap_message_queue_->AcquireSendMessageScope();
frame_swap_message_queue_->DrainMessages(messages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

#include <stddef.h>

#include <memory>
#include <vector>

#include "base/callback.h"
#include "base/cancelable_callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/managed_memory_policy.h"
Expand Down Expand Up @@ -90,7 +90,8 @@ class SynchronousCompositorOutputSurface
void DemandDrawSw(SkCanvas* canvas);
void SetMemoryPolicy(size_t bytes_limit);
void SetTreeActivationCallback(const base::Closure& callback);
void GetMessagesToDeliver(std::vector<scoped_ptr<IPC::Message>>* messages);
void GetMessagesToDeliver(
std::vector<std::unique_ptr<IPC::Message>>* messages);

size_t GetMemoryPolicy() const {
return memory_policy_.bytes_limit_when_visible;
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/android/synchronous_compositor_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void SynchronousCompositorProxy::DidActivatePendingTree() {

void SynchronousCompositorProxy::DeliverMessages() {
DCHECK(output_surface_);
std::vector<scoped_ptr<IPC::Message>> messages;
std::vector<std::unique_ptr<IPC::Message>> messages;
output_surface_->GetMessagesToDeliver(&messages);
for (auto& msg : messages) {
Send(msg.release());
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/android/synchronous_compositor_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class SynchronousCompositorProxy

// From browser.
size_t bytes_limit_;
scoped_ptr<SharedMemoryWithSize> software_draw_shm_;
std::unique_ptr<SharedMemoryWithSize> software_draw_shm_;

// To browser.
mutable uint32_t version_; // Mustable so PopulateCommonParams can be const.
Expand Down
9 changes: 4 additions & 5 deletions content/renderer/bluetooth/bluetooth_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "content/child/thread_safe_sender.h"
Expand Down Expand Up @@ -50,7 +49,7 @@ struct BluetoothPrimaryServiceRequest {

blink::WebString device_id;
blink::WebString service_uuid;
scoped_ptr<blink::WebBluetoothGetPrimaryServiceCallbacks> callbacks;
std::unique_ptr<blink::WebBluetoothGetPrimaryServiceCallbacks> callbacks;
};

struct BluetoothCharacteristicRequest {
Expand All @@ -65,7 +64,7 @@ struct BluetoothCharacteristicRequest {

blink::WebString service_instance_id;
blink::WebString characteristic_uuid;
scoped_ptr<blink::WebBluetoothGetCharacteristicCallbacks> callbacks;
std::unique_ptr<blink::WebBluetoothGetCharacteristicCallbacks> callbacks;
};

struct BluetoothCharacteristicsRequest {
Expand All @@ -76,7 +75,7 @@ struct BluetoothCharacteristicsRequest {
~BluetoothCharacteristicsRequest() {}

blink::WebString service_instance_id;
scoped_ptr<blink::WebBluetoothGetCharacteristicsCallbacks> callbacks;
std::unique_ptr<blink::WebBluetoothGetCharacteristicsCallbacks> callbacks;
};

// Struct that holds a pending Start/StopNotifications request.
Expand All @@ -103,7 +102,7 @@ struct BluetoothNotificationsRequest {
// characteristicObjectRemoved will null any pointers to the object
// and queue a stop notifications request if necessary.
blink::WebBluetoothRemoteGATTCharacteristic* characteristic;
scoped_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks;
std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks;
NotificationsRequestType type;
};

Expand Down
5 changes: 3 additions & 2 deletions content/renderer/bluetooth/web_bluetooth_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "content/renderer/bluetooth/web_bluetooth_impl.h"

#include "base/memory/ptr_util.h"
#include "content/child/mojo/type_converters.h"
#include "content/child/thread_safe_sender.h"
#include "content/public/common/service_registry.h"
Expand Down Expand Up @@ -79,7 +80,7 @@ void WebBluetoothImpl::writeValue(
mojo::Array<uint8_t>::From(value),
base::Bind(&WebBluetoothImpl::OnWriteValueComplete,
base::Unretained(this), value,
base::Passed(make_scoped_ptr(callbacks))));
base::Passed(base::WrapUnique(callbacks))));
}

void WebBluetoothImpl::startNotifications(
Expand Down Expand Up @@ -114,7 +115,7 @@ void WebBluetoothImpl::registerCharacteristicObject(

void WebBluetoothImpl::OnWriteValueComplete(
const blink::WebVector<uint8_t>& value,
scoped_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks,
std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks,
blink::mojom::WebBluetoothError error) {
if (error == blink::mojom::WebBluetoothError::SUCCESS) {
callbacks->onSuccess(value);
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/bluetooth/web_bluetooth_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class CONTENT_EXPORT WebBluetoothImpl
private:
void OnWriteValueComplete(
const blink::WebVector<uint8_t>& value,
scoped_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks,
std::unique_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks,
blink::mojom::WebBluetoothError error);

BluetoothDispatcher* GetDispatcher();
Expand Down
3 changes: 2 additions & 1 deletion content/renderer/browser_plugin/browser_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

#include "third_party/WebKit/public/web/WebPlugin.h"

#include <memory>

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner_helpers.h"
#include "content/renderer/mouse_lock_dispatcher.h"
Expand Down
4 changes: 3 additions & 1 deletion content/renderer/browser_plugin/browser_plugin_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// found in the LICENSE file.

#include "content/renderer/browser_plugin/browser_plugin_manager.h"
#include "base/memory/scoped_ptr.h"

#include <memory>

#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/frame_messages.h"
Expand Down
6 changes: 3 additions & 3 deletions content/renderer/browser_render_view_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void InterceptNetworkTransactions(net::URLRequestContextGetter* getter,
net::HttpCache* cache(
getter->GetURLRequestContext()->http_transaction_factory()->GetCache());
DCHECK(cache);
scoped_ptr<net::FailingHttpTransactionFactory> factory(
std::unique_ptr<net::FailingHttpTransactionFactory> factory(
new net::FailingHttpTransactionFactory(cache->GetSession(), error));
// Throw away old version; since this is a browser test, there is no
// need to restore the old state.
Expand All @@ -100,7 +100,7 @@ void CallOnUIThreadValidatingReturn(const base::Closure& callback,

// Must be called on IO thread. The callback will be called on
// completion of cache clearing on the UI thread.
void BackendClearCache(scoped_ptr<disk_cache::Backend*> backend,
void BackendClearCache(std::unique_ptr<disk_cache::Backend*> backend,
const base::Closure& callback,
int rv) {
DCHECK(*backend);
Expand All @@ -117,7 +117,7 @@ void ClearCache(net::URLRequestContextGetter* getter,
net::HttpCache* cache(
getter->GetURLRequestContext()->http_transaction_factory()->GetCache());
DCHECK(cache);
scoped_ptr<disk_cache::Backend*> backend(new disk_cache::Backend*);
std::unique_ptr<disk_cache::Backend*> backend(new disk_cache::Backend*);
*backend = NULL;
disk_cache::Backend** backend_ptr = backend.get();

Expand Down
2 changes: 1 addition & 1 deletion content/renderer/cache_storage/cache_storage_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void CacheStorageDispatcher::OnCacheStorageOpenSuccess(int thread_id,
int request_id,
int cache_id) {
DCHECK_EQ(thread_id, CurrentWorkerId());
scoped_ptr<WebCache> web_cache(
std::unique_ptr<WebCache> web_cache(
new WebCache(weak_factory_.GetWeakPtr(), cache_id));
web_caches_.AddWithID(web_cache.get(), cache_id);
UMA_HISTOGRAM_TIMES("ServiceWorkerCache.CacheStorage.Open",
Expand Down
4 changes: 2 additions & 2 deletions content/renderer/child_frame_compositing_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

#include <stdint.h>

#include <memory>
#include <string>
#include <vector>

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "cc/surfaces/surface_id.h"
Expand Down Expand Up @@ -122,7 +122,7 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
base::WeakPtr<BrowserPlugin> browser_plugin_;
RenderFrameProxy* render_frame_proxy_;

scoped_ptr<blink::WebLayer> web_layer_;
std::unique_ptr<blink::WebLayer> web_layer_;
cc::SurfaceId surface_id_;
blink::WebFrame* frame_;

Expand Down
5 changes: 3 additions & 2 deletions content/renderer/device_sensors/device_light_event_pump.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_
#define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_

#include <memory>

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "content/common/device_sensors/device_light_data.h"
#include "content/renderer/device_sensors/device_sensor_event_pump.h"
#include "content/renderer/shared_memory_seqlock_reader.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ class CONTENT_EXPORT DeviceLightEventPump
private:
bool ShouldFireEvent(double data) const;

scoped_ptr<DeviceLightSharedMemoryReader> reader_;
std::unique_ptr<DeviceLightSharedMemoryReader> reader_;
double last_seen_data_;

DISALLOW_COPY_AND_ASSIGN(DeviceLightEventPump);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class DeviceLightEventPumpTest : public testing::Test {
DeviceLightHardwareBuffer* buffer() { return buffer_; }

private:
scoped_ptr<MockDeviceLightListener> listener_;
scoped_ptr<DeviceLightEventPumpForTesting> light_pump_;
std::unique_ptr<MockDeviceLightListener> listener_;
std::unique_ptr<DeviceLightEventPumpForTesting> light_pump_;
base::SharedMemoryHandle handle_;
base::SharedMemory shared_memory_;
DeviceLightHardwareBuffer* buffer_;
Expand Down
Loading

0 comments on commit cedca56

Please sign in to comment.