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

Unified Diff: extensions/browser/api/async_api_function.cc

Issue 177003015: Pull AsyncApiFunction out of src/chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase for storage_api Created 6 years, 10 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 | « extensions/browser/api/async_api_function.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/async_api_function.cc
diff --git a/chrome/browser/extensions/api/api_function.cc b/extensions/browser/api/async_api_function.cc
similarity index 59%
rename from chrome/browser/extensions/api/api_function.cc
rename to extensions/browser/api/async_api_function.cc
index 54bf8e32dee53951afd51a8c8fe10beef78065f8..1fb37a58480a7f1ae367969fbd36012f44780183 100644
--- a/chrome/browser/extensions/api/api_function.cc
+++ b/extensions/browser/api/async_api_function.cc
@@ -1,30 +1,20 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 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 "chrome/browser/extensions/api/api_function.h"
+#include "extensions/browser/api/async_api_function.h"
#include "base/bind.h"
-#include "chrome/browser/profiles/profile.h"
#include "extensions/browser/extension_system.h"
using content::BrowserThread;
namespace extensions {
-ApiFunction::ApiFunction() {
-}
-
-ApiFunction::~ApiFunction() {
-}
-
// AsyncApiFunction
-AsyncApiFunction::AsyncApiFunction()
- : work_thread_id_(BrowserThread::IO) {
-}
+AsyncApiFunction::AsyncApiFunction() : work_thread_id_(BrowserThread::IO) {}
-AsyncApiFunction::~AsyncApiFunction() {
-}
+AsyncApiFunction::~AsyncApiFunction() {}
bool AsyncApiFunction::RunImpl() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -33,18 +23,16 @@ bool AsyncApiFunction::RunImpl() {
return false;
}
bool rv = BrowserThread::PostTask(
- work_thread_id_, FROM_HERE,
+ work_thread_id_,
+ FROM_HERE,
base::Bind(&AsyncApiFunction::WorkOnWorkThread, this));
DCHECK(rv);
return true;
}
-bool AsyncApiFunction::PrePrepare() {
- return true;
-}
+bool AsyncApiFunction::PrePrepare() { return true; }
-void AsyncApiFunction::Work() {
-}
+void AsyncApiFunction::Work() {}
void AsyncApiFunction::AsyncWorkStart() {
Work();
@@ -54,7 +42,8 @@ void AsyncApiFunction::AsyncWorkStart() {
void AsyncApiFunction::AsyncWorkCompleted() {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
bool rv = BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
+ BrowserThread::UI,
+ FROM_HERE,
base::Bind(&AsyncApiFunction::RespondOnUIThread, this));
DCHECK(rv);
} else {
@@ -64,10 +53,10 @@ void AsyncApiFunction::AsyncWorkCompleted() {
void AsyncApiFunction::WorkOnWorkThread() {
DCHECK(BrowserThread::CurrentlyOn(work_thread_id_));
- DLOG_IF(ERROR, (work_thread_id_ == BrowserThread::UI)) <<
- "You have specified that AsyncApiFunction::Work() should happen on "
- "the UI thread. This nullifies the point of this class. Either "
- "specify a different thread or derive from a different class.";
+ DLOG_IF(ERROR, (work_thread_id_ == BrowserThread::UI))
+ << "You have specified that AsyncApiFunction::Work() should happen on "
+ "the UI thread. This nullifies the point of this class. Either "
+ "specify a different thread or derive from a different class.";
AsyncWorkStart();
}
« no previous file with comments | « extensions/browser/api/async_api_function.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698