Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Unified Diff: webkit/blob/blob_data_handle.cc

Issue 15746017: Move webkit/blob to new locations. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/blob/blob_data_handle.h ('k') | webkit/blob/blob_storage_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_data_handle.cc
===================================================================
--- webkit/blob/blob_data_handle.cc (revision 202679)
+++ webkit/blob/blob_data_handle.cc (working copy)
@@ -1,56 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/blob/blob_data_handle.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "base/sequenced_task_runner.h"
-#include "webkit/blob/blob_data.h"
-#include "webkit/blob/blob_storage_context.h"
-
-namespace webkit_blob {
-
-BlobDataHandle::BlobDataHandle(BlobData* blob_data, BlobStorageContext* context,
- base::SequencedTaskRunner* task_runner)
- : blob_data_(blob_data),
- context_(context->AsWeakPtr()),
- io_task_runner_(task_runner) {
- // Ensures the uuid remains registered and the underlying data is not deleted.
- DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
- context_->IncrementBlobRefCount(blob_data->uuid());
- blob_data_->AddRef();
-}
-
-BlobDataHandle::~BlobDataHandle() {
- if (io_task_runner_->RunsTasksOnCurrentThread()) {
- // Note: Do not test context_ or alter the blob_data_ refcount
- // on the wrong thread.
- if (context_)
- context_->DecrementBlobRefCount(blob_data_->uuid());
- blob_data_->Release();
- return;
- }
-
- io_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&DeleteHelper, context_, base::Unretained(blob_data_)));
-}
-
-BlobData* BlobDataHandle::data() const {
- DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
- return blob_data_;
-}
-
-// static
-void BlobDataHandle::DeleteHelper(
- base::WeakPtr<BlobStorageContext> context,
- BlobData* blob_data) {
- if (context)
- context->DecrementBlobRefCount(blob_data->uuid());
- blob_data->Release();
-}
-
-} // namespace webkit_blob
« no previous file with comments | « webkit/blob/blob_data_handle.h ('k') | webkit/blob/blob_storage_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698